Determining context using weighted parsing scoring

According to one embodiment, a method, computer system, and computer program product for natural language processing is provided. The present invention may include detecting natural language entities, and running parsing algorithms on the natural language entities to determine the relationship between said natural language entities. The present invention may further comprise assigning, by the parsing algorithms, initial scores to detected natural language entities based on the relationship between said natural language entities; choosing a final score for plurality of natural language entities; and comparing the final score against a threshold to determine whether the natural language entities are within the same context.

BACKGROUND

Natural language processing is a field of computing concerned with interactions between computers and natural human languages. As computing power has become cheaper, faster, and more powerful, many companies are rushing to develop personal assistants capable of communicating with humans using natural language for phones, tablets, computer operating systems and even purpose-built home automation appliances to provide intuitive machine-man interfacing. As such, the field of natural language processing has massively grown in relevance in recent years, and streamlining the process is of immense commercial importance. A primary goal of the field is to enable computers to successfully process large corpora of natural language text. Achieving this goal requires that computers understand not only the denotative meaning of the text, but the connotative meaning as well; the definition of words can change depending on context. Consequently, an understanding of natural language requires an understanding of the context within which that language appears, which complicates the process of creating effective natural language processors.

SUMMARY

According to one embodiment, a method, computer system, and computer program product for natural language processing is provided. The present invention may include detecting natural language entities, and running parsing algorithms on the natural language entities to determine the relationship between said natural language entities. The present invention may further comprise assigning, by the parsing algorithms, initial scores to detected natural language entities based on the relationship between said natural language entities; choosing a final score for plurality of natural language entities; and comparing the final score against a threshold to determine whether the natural language entities are within the same context.

DETAILED DESCRIPTION

Embodiments of the present invention relate to the field of computing, and more particularly to the field of natural language processing. The following described exemplary embodiments provide a system, method, and program product to, among other things, utilize linguistic and lexical features to enumerate the relationship between natural language entities. Therefore, the present embodiment has the capacity to improve the technical field of natural language processing by offering a natural language processing solution that is domain-independent; the presented embodiment of the invention utilizes generalizable natural language processing algorithms that are generic enough such that developers would not need to write rules with different intervening tokens to be able to make a connection between pairs of entities. Furthermore, the present embodiment of the invention has the advantage of being capable of multiple applications, such as co-reference resolution (if two entities are related to each other, the entities could be combined to obtain a more complete understanding of the larger entity, determining more specific features of the larger entity), summarization (if two entities are related both should be present in the summary), and question answering (for more concrete answers, it is necessary to find hidden relationships in the text).

As previously described, natural language processing is a field of computing concerned with interactions between computers and natural human languages. A primary goal of the field is to enable computers to successfully process large corpora of natural language text. Achieving this goal requires that computers understand not only the denotative meaning of the text, but the connotative meaning as well; the definition of words can change depending on context. Consequently, an understanding of natural language requires an understanding of the context within which that language appears. Determining context in rich natural language is a challenging task; there are many different ways of articulating the same meanings. Furthermore, the wordings change from one context to another; as an example, the algorithms used to determine if two entities that are in the same context in a medical application may not be the same as the algorithms that are applied in a financial context. Rule-based approaches make it difficult to scale natural language understanding algorithms, and therefore the rules need to be rewritten every time a new corpus is introduced for a different domain.

The task of relating entities that are relevant to each other is an important one for several applications, including co-reference resolution, summarization and question answering. In order to draw a higher level picture of a textual document, it is crucial to incorporate semantics, i.e., understanding the entities that have connection. The prior art has struggled to produce methods of parsing natural language entities to enumerate the quality of relationships between said entities in a fashion that is efficient and scalable. Therefore, it is desirable to, among other things, provide domain-independent, generalizable natural language processing algorithms that are generic enough so that developers would not need to write rules with different intervening tokens to be able to make a connection between pairs of entities. Most of the time, relating entities directly impacts disambiguation; an example could be classifying a measurement as a tumor measurement, lymph node measurement, or a margins distance. Once the algorithm knows that the measurement is related to a mass, the size can be disambiguated and classified as a tumor measurement. It is further desirable to provide a method of natural language processing that has multiple applications, such as co-reference resolution (if two entities are related to each other, the entities could be combined to obtain a more complete understanding of the larger entity, determining more specific features of the larger entity), summarization (if two entities are related both should be present in the summary), and question answering (for more concrete answers, it is necessary to find hidden relationships in the text).

According to one embodiment, the invention is a computer program capable of utilizing linguistic and lexical features to be able to construct a score enumerating the relationship between pairs of natural language entities, where the higher the score, the greater the likelihood that the entities are related. The framework utilizes a set of parsing algorithms, run simultaneously to determine multiple scores. Punctuation and conjunctions are used to further adjust scores returned by each algorithm. Then the scores are sorted and if the highest score that is returned by the set of parsing algorithms is below a pre-defined threshold, the two entities are accepted as related and the highest score is assigned as the confidence for this conclusion.

The following described exemplary embodiments provide a system, method, and program product to utilize linguistic and lexical features to formulate a score that enumerates the likelihood that two natural language entities are contextually related.

Referring toFIG. 1, an exemplary networked computer environment100is depicted, according to at least one embodiment. The networked computer environment100may include client computing device102and a server112interconnected via a communication network114. According to at least one implementation, the networked computer environment100may include a plurality of client computing devices102and servers112, of which only one of each is shown for illustrative brevity.

Client computing device102may include a processor104and a data storage device106that is enabled to host and run a natural language processing pipeline108and a natural language context determination program110A and communicate with the server112via the communication network114, in accordance with one embodiment of the invention. Client computing device102may be, for example, a mobile device, a telephone, a personal digital assistant, a netbook, a laptop computer, a tablet computer, a desktop computer, or any type of computing device capable of running a program and accessing a network. As will be discussed with reference toFIG. 6, the client computing device102may include internal components602aand external components604a, respectively.

The server computer112may be a laptop computer, netbook computer, personal computer (PC), a desktop computer, or any programmable electronic device or any network of programmable electronic devices capable of hosting and running a natural language context determination program110B and a database116and communicating with the client computing device102via the communication network114, in accordance with embodiments of the invention. As will be discussed with reference toFIG. 6, the server computer112may include internal components602band external components604b, respectively. The server112may also operate in a cloud computing service model, such as Software as a Service (SaaS), Platform as a Service (PaaS), or Infrastructure as a Service (IaaS). The server112may also be located in a cloud computing deployment model, such as a private cloud, community cloud, public cloud, or hybrid cloud.

Natural language processing pipeline108may be any computer program or combinations of computer programs capable of accepting natural language as an input, and processing natural language into a state that is computer-readable, and may further be capable of performing actions or serving requests derived from the natural language input. The natural language processing pipeline108may serve as part of a medical treatment recommendation system, such as IBM Watson® (IBM Watson® and all IBM Watson® based trademarks and logos are trademarks or registered trademarks of International Business Machines Corporation and/or its affiliates), where co-reference resolution is conducted, or natural language processing pipeline108may be in a dialogue manager, such as Ski® (Siri® and all Siri® based trademarks and logos are trademarks or registered trademarks of Apple Inc. and/or its affiliates), that determines related entities to better generate a system response.

According to the present embodiment, the natural language context determination program110A,110B may be a program capable of utilizing linguistic and lexical features to determine whether two entities in a textual document are related in a generic way. The natural language context determination method is explained in further detail below with respect toFIG. 2. In one embodiment, natural language context determination110A,110B may be intended to run in the natural language understanding step of a natural language processing pipeline108.

Referring now toFIG. 2, an operational flowchart illustrating a natural language context determination process200is depicted according to at least one embodiment. At202, the natural language context determination program110A,110B detects natural language entities. A natural language entity may be a semantic categorization of a token or a group of tokens based on the requirements of the natural language context determination process. For instance, “3 cm” is an entity, specifically an observation size. “Mass” is an entity, specifically a tumor trigger. The natural language context determination program110A,110B annotates entities in text to make sense of unstructured text and use those entities to derive conclusions. For example, in at least one embodiment, observation size and tumor trigger are related, therefore 3 cm should be a tumor measurement, which then becomes a tumor measurement entity. The entities may be detected by natural language processing pipeline108using semantic parsers or other methods known to the art.

Next, at204, natural language context determination program110A,110B runs parsing algorithms on every anchor-trigger pair. An anchor-trigger pair may be a pair of entities that natural language context determination program110A,110B attempts to find the relationships between. The term ‘anchor’ represents an entity around which natural language context determination program110A,110B will search for triggers. Here, the assumption is that there should be triggers in the context of an anchor, so that the anchor and trigger would be related (i.e. in the same context). Anchors and triggers are simply entities but depending on what relationship natural language context determination program110A,110B wants to find, one entity may be treated as an anchor and another may be treated as a trigger. The purpose of the parsing algorithm may be, among other things, to parse out natural language text in a language tree structure and identify entities and relationships within that language. The algorithm may further evaluate anchor-trigger pairs in order to compute whether each pair is in the same context, and return a score which serves to enumerate the contextual relationship between the anchor and the triggers. These parsing algorithms may include, among others, parse tree relationship algorithms, shortest path algorithms, and fallback algorithms. There is no minimum or maximum number of parsing algorithms that can be run; natural language context determination program110A,110B may incorporate multiple parsing algorithms and prioritize their results based on the scores the parsing algorithms return. The parse tree relationship algorithm is further depicted inFIG. 3; child-parent relationships within the parse tree relationship algorithm are further illustrated inFIG. 4.

The shortest path algorithm may also be used; like the parse tree relationship algorithm, this algorithm utilizes a parse tree, and calculates the distance of the shortest path from one node to another to produce its score. An example of this algorithm is illustrated inFIG. 5.

The fallback algorithm is another suitable algorithm. The fallback algorithm is run only when a parse tree is incomplete; as such, the algorithm utilizes proximity-based rules, and no parse tree. The assumption behind the fallback algorithm is that two entities are more likely to be related to each other if the entities are closer in the sentence. The algorithm calculates the score based on the normalized distance between the anchor and the trigger, and prioritizes anchor-trigger pairs that are closer in the sentence.

Then, at206, natural language context determination program110A,110B generates generic and fragment scores. The generic score is the score returned by an algorithm, and therefore may differ according to which algorithm was used. The fragment score is adjusted version of the generic score where punctuation/conjunction weights have been taken into account. For example, if the conjunction “and” has a weight of 0.1 and the generic score is 0.8, the fragment score would be =0.8−0.1=0.7. With a negative weight example such as “/”, if the weight is 0.5, and the generic score is 0.8, the fragment score would be =0.8−0.5=0.85. Every punctuation/conjunction entity has its own weights which may increase or decrease the score. Additionally, the generic score may be used to further adjust each segment; if the anchor-trigger pair is within the same fragment, the score increases and becomes the new fragment score. If the anchor-trigger pair is not within the same fragment, the likelihood of their being related is less, which will decrease the score. Each fragment is a segment of the tree as divided by conjunctions. The fragment score is lowered if anchor and trigger are in separate fragments. For instance, in the example where a chest cat scan reveals a 4 cm right upper lobe mass and a 3 cm right mediastinal lymph node, the anchors are 4 cm and 3 cm, and the triggers are mass and mediastinal lymph node. Since 4 cm and mass are in the same fragment, but 4 cm and mediastinal lymph node are not, the likelihood of 4 cm being related to mass is higher than the likelihood of 4 cm being related to mediastinal lymph node. Therefore, natural language context determination program110A,110B may conclude that 4 cm is a tumor measurement (as the measurement is connected to a mass), and 3 cm is a lymph node measurement (as the measurement is connected to the mediastinal lymph node).

Next, at208, natural language context determination program110A,110B creates a final score for each anchor-trigger pair from the generic and fragment scores. Natural language context determination program110A,110B may use different combinations of generic scores and fragment scores in determining the final score, for instance where there is no conjunction in the sentence, or where the generic score and the fragment score are the same. Every anchor-trigger pair will have a generic and a fragment score. The combination may be an average, a weighted average, the lowest score, or the highest score. Alternatively, natural language context determination program110A,110B may also use the unaltered generic or fragment score as the final score. The current embodiment contemplates the use of unaltered fragment scores as the final score for each anchor-trigger pair, because the addition of conjunctions and punctuation information may increase accuracy, at the expense of resource intensity.

Then, at210, natural language context determination program110A,110B chooses the highest final score and compares that final score against a threshold. The threshold is a number above which a final score is high enough that the corresponding anchor-trigger pair is considered related, and below which the final score represents an anchor-trigger pair that is not related. This threshold is provided to the process as an input, and can be formulated by means of several methods, including empirical data that is collected and analyzed to create the optimal threshold, or by machine learning. One example of the former method may entail taking two entities that are already known to be connected, and setting an arbitrary threshold to see if the algorithms actually return the expected “connected” result. This process is then repeated for several anchor-trigger pairs. The initial threshold is then modulated to produce a number that maximizes the number of correct relations.

The highest final score is selected from among all of the scores returned for each anchor trigger pair by different parsing algorithms. Natural language context determination program110A,110B may also take into account the scores for all triggers given an anchor. In alternate embodiments, natural language context determination program110A,110B may choose a different score based on the implementation logic; natural language context determination program110A,110B may choose to only use the top score, or may utilize all triggers that have a score above a threshold for the given anchor. Once the scores are determined for anchor-trigger pairs in a sentence, it is up to the remaining logic to decide which triggers to use. The goal of these parsing algorithms is to determine which anchor-trigger pairs are in the same context.

Next, at212, natural language context determination program110A,110B performs a cognitive operation on the natural language entities based on the result of the comparison. These cognitive operations may include answering a natural language input question, generating search results, identifying related portions of content, identifying related concepts in multiple documents, or scoring related concepts. In an alternate embodiment, natural language context determination program110A,110B may choose to perform no cognitive operation, and/or may instead pass the results of the context determination to the natural language processing pipeline108.

FIG. 3is an exemplary segment block diagram300illustrating an exemplary segment of natural language parsed out by the parse tree relationship algorithm. The parse tree relationship algorithm parses natural language into a tree structure, consisting of a series of linked nodes branching downwards from a single root value to reflect the syntax of the input language; in this figure, the root value is a verb, and the child nodes are parsed out according to their contextual relationship to each other. In this example, the sentence “A chest CT revealed a 4 cm right upper lobe mass and a 3 cm right mediastinal lymph node” has been parsed out. Groups of words and phrases that are connected to each other are organized into fragments304and306; here the dependent nodes of the anchors “a 4 cm right upper lobe mass” and “a 3 cm right mediastinal lymph node” are grouped into fragments304and306, respectively. The fragments are determined by the parsing algorithms enclosed in this disclosure. The use of conjunctions such as conjunction302helps identify fragment boundaries.

FIG. 4is a child relationship block diagram400illustrating an example of a child relationship in a parse tree algorithm. In this example, the phrase “there was a 6 cm tumor in the lung” has been parsed out by the parse tree algorithm. Here, the trigger is ‘tumor,’ and the anchor is ‘6 cm.’ By finding the relationship between “6 cm” and tumor, it is possible to disambiguate the observation size (6 cm) and convert the observation size to a more specific measurement (e.g., tumor measurement as opposed to lymph node measurement). The parse tree relationship algorithm may also use part of speech tags and slot names, which are tags assigned to nodes of the tree. The use of slot names allows the algorithm to model more nuanced relationships between nodes.

FIG. 5is a functional block diagram500illustrating an example of the shortest path algorithm. The shortest path algorithm may set a pre-defined score if the shortest path distance between the anchor and the trigger is below a threshold. In this figure, the sentence “a core needle biopsy of a lung lesion revealed adenocarcinoma” has been parsed out into a tree structure. The anchor in this example is “lung,” and the triggers are “lesion” and “revealed adenocarcinoma.”

It may be appreciated thatFIGS. 2-5provide only illustrations of particular implementations and do not imply any limitations with regard to how different embodiments may be implemented. Many modifications to the depicted environments may be made based on design and implementation requirements.

The client computing device102and the server112may include respective sets of internal components602a,band external components604a,billustrated inFIG. 6. Each of the sets of internal components602include one or more processors620, one or more computer-readable RAMs622, and one or more computer-readable ROMs624on one or more buses626, and one or more operating systems628and one or more computer-readable tangible storage devices630. The one or more operating systems628, the natural language processing pipeline108and the natural language context determination program110A in the client computing device102, and the natural language context determination program110B in the server112are stored on one or more of the respective computer-readable tangible storage devices630for execution by one or more of the respective processors620via one or more of the respective RAMs622(which typically include cache memory). In the embodiment illustrated inFIG. 6, each of the computer-readable tangible storage devices630is a magnetic disk storage device of an internal hard drive. Alternatively, each of the computer-readable tangible storage devices630is a semiconductor storage device such as ROM624, EPROM, flash memory or any other computer-readable tangible storage device that can store a computer program and digital information.

Each set of internal components602a,balso includes a R/W drive or interface632to read from and write to one or more portable computer-readable tangible storage devices638such as a CD-ROM, DVD, memory stick, magnetic tape, magnetic disk, optical disk or semiconductor storage device. A software program, such as the cognitive screen protection program110A,110B, can be stored on one or more of the respective portable computer-readable tangible storage devices638, read via the respective R/W drive or interface632, and loaded into the respective hard drive630.

Each set of internal components602a,balso includes network adapters or interfaces636such as a TCP/IP adapter cards, wireless Wi-Fi interface cards, or 3G or 4G wireless interface cards or other wired or wireless communication links. The natural language processing pipeline108and the natural language context determination program110A in the client computing device102and the natural language context determination program110B in the server112can be downloaded to the client computing device102and the server112from an external computer via a network (for example, the Internet, a local area network or other, wide area network) and respective network adapters or interfaces636. From the network adapters or interfaces636, the natural language processing pipeline108and the natural language context determination program110A in the client computing device102and the natural language context determination program110B in the server112are loaded into the respective hard drive630. The network may comprise copper wires, optical fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers.

Each of the sets of external components604a,bcan include a computer display monitor644, a keyboard642, and a computer mouse634. External components604a,bcan also include touch screens, virtual keyboards, touch pads, pointing devices, and other human interface devices. Each of the sets of internal components602a,balso includes device drivers640to interface to computer display monitor644, keyboard642, and computer mouse634. The device drivers640, R/W drive or interface632, and network adapter or interface636comprise hardware and software (stored in storage device630and/or ROM624).

Characteristics are as follows:

Service Models are as follows:

Deployment Models are as follows:

Workloads layer90provides examples of functionality for which the cloud computing environment may be utilized. Examples of workloads and functions which may be provided from this layer include: mapping and navigation91; software development and lifecycle management92; virtual classroom education delivery93; data analytics processing94; transaction processing95; and natural language context determination96. Natural language context determination96may relate to utilizing linguistic and lexical features to formulate a score that enumerates the likelihood that two natural language entities are contextually related.