The present invention relates to natural language processing. More specifically, the present invention relates to a named entity recognition system that uses standard compiler tools to identify named entities.
Named entities are terms in natural language text or speech identifying individual concepts by name, such as person or company names. Broadly, named entities can also include temporal expressions such as date or time expressions, locations, which can include virtual locations such as email and web addresses, and quantity expressions such as digits, number words, monetary values, percentages and the like. Generally, named entity terms cannot be reliably identified by simple matching against stored lists or lexicons because such lists of all known names would be impractically large to maintain. Also, novel names are continually being created.
Named entity terms, however, do have internal linguistic structure, which can be described by relatively simple grammatical or linguistic rules. These simple grammatical rules can be used to recognize or identify named entities by parsing natural language text. However, the expense of analyzing text with a full natural language parser usually means that the computational cost of named entity recognition is too high to be considered in any application where performance is an important consideration.
An improved method of recognizing, identifying or extracting named entities in natural language text that addresses one, some or all of the problems would have significant utility.
The present inventions include methods of identifying named entities from a natural language text using machine or computer compiler tools. In some embodiments, a compiler tool commonly referred to as a lexical analyzer (scanner) generator, e.g. Flex or Lex or an equivalent tool, is used to identify named entities (e.g. digits, date and time expressions, and email or web addresses) using regular expression rules. In other embodiments, another compiler tool commonly referred to as a parser generator, e.g. Yacc or Bison or an equivalent tool, is used to identify named entities (e.g. person and company names) using grammar rules. In still other embodiments, a lexical analyzer generator is used in combination with a parser generator to identify named entities in natural language text. In some embodiments, multiple lexical analyzers and/or parsers identify one or more classes of named entities, such as email addresses or person names, which can be used to produce an annotated version of the text. In many embodiments, this annotated text can be further processed or searched by natural language processing applications.
The present invention relates to identifying or extracting named entities in natural language text processing. As used herein, the term “named entity” includes numbers, date and time expressions, email addresses, web addresses, currencies, and other regular expressions. “Named entity” further includes names such as person, company, location, country, state, city, and the like. In one aspect, a standard machine compiler comprising compiler tools such as Flex and/or Yacc is used for named entity recognition, and in one particular aspect, to construct or update at least one index including named entities. However, prior to discussing the present invention in greater detail, one illustrative environment in which the present invention can be used will be described.
The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, telephone systems, distributed computing environments that include any of the above systems or devices, and the like.
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Those skilled in the art can implement the description and figures provided herein as processor executable instructions, which can be written on any form of a computer readable medium.
The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
With reference to
Computer 110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 110 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computer 110. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media.
The system memory 130 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 131 and random access memory (RAM) 132. A basic input/output system 133 (BIOS), containing the basic routines that help to transfer information between elements within computer 110, such as during start-up, is typically stored in ROM 131. RAM 132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 120. By way of example, and not limitation,
The computer 110 may also include other removable/non-removable volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media discussed above and illustrated in
A user may enter commands and information into the computer 110 through input devices such as a keyboard 162, a microphone 163, and a pointing device 161, such as a mouse, trackball or touch pad. Other input devices (not shown) may include a joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 120 through a user input interface 160 that is coupled to the system bus, but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190. In addition to the monitor, computers may also include other peripheral output devices such as speakers 197 and printer 196, which may be connected through an output peripheral interface 190.
The computer 110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180. The remote computer 180 may be a personal computer, a hand-held device, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 110. The logical connections depicted in
When used in a LAN networking environment, the computer 110 is connected to the LAN 171 through a network interface or adapter 170. When used in a WAN networking environment, the computer 110 typically includes a modem 172 or other means for establishing communications over the WAN 173, such as the Internet. The modem 172, which may be internal or external, may be connected to the system bus 121 via the user input interface 160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 110, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
Natural language processing system 200 includes natural language programming interface 202, natural language processing (NLP) engines 204, and associated lexicons 206.
Programming interface 202 exposes elements (methods, properties and interfaces) that can be invoked by application layer 208. The elements of programming interface 202 are supported by an underlying object model (further details of which are provided in the above incorporated patent application) such that an application in application layer 208 can invoke the exposed elements to obtain natural language processing services.
In order to do so, an application in layer 208 can first access the object model that exposes interface 202 to configure interface 202. The term “configure” is meant to include selecting desired natural language processing features or functions. For instance, the application may wish to have word breaking or language auto detection performed as well as any of a wide variety of other features or functions. Those features can be elected in configuring interface 202 as well.
Once interface 202 is configured, application layer 208 may provide text, such as natural language text received from the Internet, to be processed to interface 202. Interface 202, in turn, can break the text into smaller pieces and access one or more natural language processing engines 204 to perform natural language processing on the input text. The results of the natural language processing performed can, for example, be provided back to the application in application layer 208 through programming interface 202 or used to update lexicons 206 (discussed below).
Interface 202 or NLP engines 204 can also utilize lexicons 206. Lexicons 206 can be updateable or fixed. System 200 can provide a core lexicon 206 so additional lexicons are not needed. However, interface 202 also exposes elements that allow applications to add customized lexicons 206. For example, if the application is directed to an Internet search engine or web crawler, a customized named entity lexicon having, e.g. person and/or company names can be added or accessed. Of course, other lexicons can be added as well. In addition, interface 202 can expose elements that allow applications to add notations to the lexicon so that when results are returned from a lexicon, the notations are provided as well, for example, as properties of the result.
Generally, compiler tools such as Flex, Lex, Yacc, or Bison are designed for the analysis of programming languages, and thus, have a limited ability to analyze patterns and/or expressions in text. However, compiler tools have been optimized over the years so that their performance is highly tuned to maximize the efficiency of their analyses.
Many named entities represent well-constrained subsets of full natural language structures. It has been discovered that many named entities generally have structures or patterns that can be described or specified in terms that allow limited programming languages and compiler tools to be used, even though their limitations are much too restrictive for general natural language processing or analysis.
In particular, it has been discovered that simple rules such as Forename+Surname (e.g. John Smith) or Ordinal+Month+Digits (e.g. 29 Feb. 2004) can be expressed within the formalism of programming language tools, and applied to input text very efficiently. Additionally, actions, processes, or steps can be associated with rules, which can be used to construct normalized representations of certain named entity categories or classes such as person names or time and date expressions. The normalized representations facilitate subsequent searching of text for particular information by abstracting away from the way in which the information was expressed in a particular text. For example, the expressions 29 Feb. 2004 and Feb. 29, 2004 can be assigned equivalent representations.
In the present inventions, character and/or token rules are advantageous because they can be authored by linguists for a particular natural language, such as English, German, or Chinese. Rules 304, 354 are implemented to identify or specify patterns in natural language text associated with named entities in the particular natural language of interest. Rules 304, 354 can comprise one or more sets of rules, each of which is associated with a particular class or category of named entity, such as email address, location name, person name, or date expression. Rules 304, 354 can also be broken up to create a cascade of recognizers (lexical analyzers or parsers), each of which is associated with one or more classes of named entities.
Optionally, finite-state recognizer 402 can output annotated text 406 comprising both natural language text and annotations. Also, optionally, recognizer 402 output can be used to build an index into the text 404 or metadata associated with text 404. Subsequent applications can use annotations, index, annotated text and/or metadata 406 to perform more advanced natural language processing or searching of text 404 than with simple tokens/words alone. It is further noted that recognizer 402 can process text in segmented languages such as English or French, which have boundaries or spaces between words or unsegmented languages such as Chinese or Korean where boundaries between words can be ambiguous.
Named entity recognition system 500 is particularly adept at recognizing named entities that have a predictable or regular format such as email addresses or date and time expressions. In most embodiments, named entity recognition system 500 implements regular expression rules similar to regular expression rules 304 illustrated in
Lexical analyzer 404 generates annotations 506 that can be output to the application layer, document index, and/or for further types of processing as indicated at 508. It is important to note that named entity recognition system 400 can be integrated in natural language processing system 200 illustrated in
Parser 552 can be generated by the well-known parser generator known as “Yacc” or “Yet Another Compiler-Compiler” from AT&T Bell Laboratories, Murray Hill, N.J. In other embodiments, parser 505 can be generated by the well-known parser generator “Bison,” for which detailed information is available at the following web address: www.gnu.org.
In some embodiments, parser 552 applies grammar rules 354 illustrated in
Parser 552 can be coupled to lexicon 558 comprising person names for look-up. For example, parser 552 can look-up titles in an existing lexicon to identify text such as “Mr.”, “Mrs.”, or “Dr.” After a title is identified, parser 552 can lookup in an existing lexicon comprising first names, and then again, in a lexicon comprising surnames. Alternatively, parser 552 implements a person name grammar rule, which checks the word following a title and first name for capitalization. If the following word is capitalized e.g. “Smith” in the example “Mr. John Smith”, the three-word string is annotated as a person name.
In another embodiment, parser 552 is coupled to lexicon 558 for more extensive look-up. This embodiment is especially applicable in situations where natural language text 404 comprises a single case (all capital or all small case letter). When a single case of text is used, it is more difficult to write character rules to specify named entities. Lexicon 558 can comprise significant named entity information, such as an extensive list of person surnames, to perform named entity look-up regardless of the case of text.
Alternatively, named entity recognition system 550 can identify named entities 556 for further processing to determine classes for which the generated named entities 556 belong. For example, the phrase “St. Paul” can be initially identified by system 550 for later determination of whether “St. Paul” is a person name or a location name.
Annotations 556 can be output to the application layer, document index, or further processing as described with respect to
Parser 604 is dedicated to rules, such as grammar rules 354 (illustrated in
In some embodiments, parser 604 is able to access lexicon 616, such as a lexicon of first names to identify and classify tokens into types. Briefly, Yacc uses a grammar to describe legal token sequences, and can also carry out actions when part or all of a sequence is found. Both Flex and Yacc compile their character and/or token rules into computer program code for highly efficient finite-state recognizers 602, 604 dedicated to those rules; and these programs are then compiled into executable programs.
For example, suppose the sequence “Mr. John Smith” is received in natural language text 404. Lexical analyzer 602 can implement a person name rule where titles or constituent character strings such as “Mr.”, “Mrs.”, “Ms.”, “Dr.”, etc. are annotated as <titles> in annotations 606. In the present case, “Mr.” would be recognized and annotated as a title annotation or token <Mr.>. Parser 604 then receives the token <Mr.> and further applies grammar rules to check words following <Mr.>. For example, parser 604 can implement grammar rules that, for example, specify that parser 604 looks up “John” in a first name lexicon 616 to determine whether “John” is a first name. The grammar rules can then specify that parser 604 determine whether “Smith” is capitalized. Assuming proper match of the text pattern to the grammar rules, parser 604 determines that “Mr. John Smith” is a person's name and annotates the text sequence as such to generate annotations 608.
System 700 includes named entity recognition engine 702 comprising cascading lexical analyzers 706, 708 and parsers 718, 720, 722, 724, 726. For purposes of understanding, it is noted that the recognition process described herein is broken up into a sequence or cascade of separate recognizers comprising both lexical analyzer (scanner) and parser modules, or steps, each specialized for a particular named entity class or category. Such a configuration, however, should not be considered limiting. It is noted that extracting various classes of named entities separately generally avoids conflicts between rules for different classes, which could otherwise overlap. Also, multiple analyses of ambiguous input text can be performed, which is not possible with a single recognizer. For example, with multiple passes “Julian Hill” can be recognized as a possible named entity by both person name and location name rules.
Further, the Flex analysis and the Yacc analysis of an input text can be split into multiple passes, each with its own set of rules, especially to avoid conflicts between overlapping or ambiguous rules, and allow recognition of natural language constructions which cannot be described in a single set of rules. Flex has a built-in limitation to find only the longest possible match. Therefore, separate passes with different rules are needed to allow any overlapping or embedded named entities to be matched. Similarly, Yacc has a built-in limitation to ignore all but the first of multiple candidate rules. If the first rule subsequently fails to match, no others will be considered, and thus, no match will be found. For named entity recognition, where multiple candidate rules are required, they can be split into separate grammars and applied in separate passes.
Importantly, both Flex and Yacc can be integrated into the Linguistic Services Platform described above, as optional features which can be applied to input text to produce a linguistically-enriched output, annotating sequences which match the named entity rules for certain classes or types. Linguistic Services Platform uses lattice 714, or table, to represent information about input text. Text 404 is passed through at least one Flex-generated or equivalent lexical analyzer and any matches cause actions to insert new information into the lattice. Then the lattice contents are passed through a Yacc-generated or equivalent parser and again any matches cause actions to insert new information into the lattice.
Referring back to
Named entity recognition engine 702 can be coupled to word breaker 704, which identifies individual words in input natural language text 404. In the embodiment illustrated in
At step 802, lexical analyzer or recognizer 706 dedicated to regular expression rules 709 performs scanning or recognition of character-based named entities or constituent character strings. In some embodiments, lexical analyzer 706 identifies named entities in the following classes: digits, date expressions, email addresses, web addresses, currencies, and similar regular expressions. In other words, rules 709 can comprise email address rules specifying any sequence of characters from a to z, followed by the symbol “@”, then by any sequence of characters from a to z, followed by a “.”, and ending with a suffix such as “com”, “org”, “edu”, etc. as described above.
Lexical analyzer 706 generates annotations or tokens that can be provided to lexical analyzer 708 directly or via lattice 714 as illustrated. Further, lexical analyzer 706 can optionally provide output directly to the application layer above as described with respect to reference 616 in
At step 804, lexical analyzer 708 receives annotations or annotated text from lexical analyzer 706 and performs further named entity and/or constituent character string scanning or recognition in accordance with regular expression rules 711 as described above. In some embodiments, rules 711 relate to the following classes of named entities: day names, month names, etc. Lexical analyzer 708 outputs annotations or annotated or tokenized text directly to parser 718, or optionally, via lattice 714 as illustrated.
At step 806, parser 718 receives annotations from both lexical analyzer 706 and lexical analyzer 708 for further named entity recognition. Parser 718 is generated by Yacc (or its equivalent) from grammar rules 713. In some embodiments, rules 713 specify named entities in the following classes: number expressions. It is noted that number named entities recognized by parser 718 are generally numbers spelled out in text such as “one hundred and thirty-three”. Parser 718 generates annotations that can be communicated to lattice 714 as illustrated or directly to parser 720.
At step 808, parser 720 receives annotations from lexical analyzer 706, lexical analyzer 708, and parser 718 for further named entity recognition. Parser 720 is generated by Yacc (or its equivalent) from grammar rules 715. In some embodiments, rules 715 specify named entities in the following classes: date expressions. Parser 720 communicates results to lattice 714 or directly to parser 722 for further similar downstream processing.
At step 810, parser 722 receives annotations from the previous modules and performs further recognition or identification of named entities. Parser 722 is generated by Yacc (or its equivalent) from grammar rules 717. As illustrated in
At step 812, named entity recognition engine 702 performs recognition of person names using parser 724, generated by Yacc (or its equivalent) from grammar rules 719. Output of parser 724 can be in the form of annotated lattice tokens to lattice 714 for further downstream processing. The Appendix below describes an embodiment of grammar rules 719 in Yacc format. At step 814, Yacc-generated (or equivalent) parser or module 726 performs named entity recognition of location names and provides annotations or lattice tokens, which can be provided to lattice 714 for later processing. At step 816, Yacc-generated (or equivalent) parser or module 728 implementing grammar rules 723 performs named entity recognition of organization names and provides annotations or lattice tokens, which can be provided to lattice 714 for later processing.
As described above, named entity recognition engine 702 identifies named entities 732 in natural language text 404 (including both character-based and token-based named entities) in accordance with regular expression rules 709, 711 and grammar rules 713, 715, 717, 719, 721, 723. Named entity annotations generated by engine 702 can be provided to lattice 714, or alternatively, to an application layer, document index, or further processing. It is important to note that the embodiments illustrated in
It is further noted that in another embodiment, at least one Yacc-generated (or equivalent) parsers 718, 720, 722, 724, 726, 728 can be adapted to look up token types, for example, in various lexicons 730 (e.g. a list of person first names) in place of or in addition to types from annotated lattice tokens, such as those provided by Flex-generated lexical analyzers or parsers 706, 708 or any upstream recognizer. Lexicon access, however, can be minimized by only looking up capitalized tokens which were not matched by the lexical analyzers. If the input text is known to be a single case, capitalization tests can be skipped and lexicon lookup increases significantly.
In other embodiments, annotated lattice tokens constructed from named entities identified by the above described Flex-based and/or Yacc-based named entity recognizers can be used for creating a web index. Due to the speed of system 700, it is contemplated that Internet web pages numbering in several billion pages of text can be processed or indexed by system 700 within several days of computing time, many times faster than would be possible with typical linguistic parsing methods.
In actual tests performed for named entity recognition in accordance with the present or similar system as illustrated in
Although the present invention has been described with reference to particular embodiments, workers skilled in the art will recognize that changes may be made in form and detail without departing from the spirit and scope of the invention.
% token FNME NME INITL VON ABRV INITCAP TITL SUFFIX HYPHEN QUOTE COMMA SKIP