# Patent

## Title
Method, system, and apparatus for converting numbers between measurement systems based upon semantically labeled strings

## Abstract

Number conversion between different units of measurement in a document is enabled. A string of text entered into an application program is analyzed to determine whether it includes a number having an associated unit name. Found numbers with associated unit names are semantically labeled with schema information identifying the unit name as a source unit of measurement. When the number is selected or an indication received that the number is labeled with schema information, a list of actions may be provided identifying conversion options for the number. In response to selection of one of the conversion options, the selected number is converted to the destination unit of measure identified by the selected action. The converted number may then be inserted into the string of text to replace the selected number along with a unit name corresponding to the destination unit of measure.

## Background
TECHNICAL FIELD
Embodiments of the present invention relate to the field of unit measurement conversion. More particularly, embodiments of the invention relate to the field of converting numbers between measurement systems based upon semantically labeled strings.
BACKGROUND OF THE INVENTION
As a result of the advent and explosion of the Internet and the World Wide Web (“Web”), computer users today frequently receive electronic documents from other users located in countries throughout the world. Electronic documents such as these often include numbers expressed in a unit of measurement utilized in the sender's particular country. For instance, users located in the United States are likely to express numbers in the Imperial system of measurement (e.g. inches, feet, etc.), while European users are likely to express numbers in the Metric system of measurement (e.g. centimeters, kilometers, etc.).
When users receive electronic documents having numbers expressed in measurement systems other than the system used in their native country, users may need to convert the numbers to their local measurement system to understand the meaning of the number. For instance, a user may want to convert a number expressed in degrees Fahrenheit, which is a unit of measure for temperatures commonly used in the United States, to degrees Celsius, which is a unit of measure for temperatures commonly used in Europe. However, converting numbers between measurement systems in this manner has heretofore been difficult for a user to accomplish easily.
Previously, if a user wanted to convert a number contained in an electronic document, such as a word processing document, between measurement systems, the user would first have to copy the number to be converted to a clipboard. The user would then paste the number into an external program or Web site capable of converting the number to the desired destination unit of measure. Once the external program or Web site had completed the conversion, the user may copy the converted number to the clipboard and then paste the converted number back into the electronic document. Although systems such as these do allow a user to convert a number between measurement systems, these systems can be difficult for to use because of the large number of steps required to complete the conversion. Moreover, these previous solutions require the user to perform the conversion using the user interface language of the conversion program or Web site. This can be extremely frustrating for a user that does not understand the language of the conversion program or Web site.
Therefore, in light of the above, there is a need for a method, system, and apparatus for easily converting numbers between measurement systems that do not require a user to utilize an external application or Web site to convert numbers between measurement systems. Moreover, there is a need for a method, system, and apparatus for converting numbers between systems of measure that can present conversion options to the user in a user-selected user interface language.
SUMMARY OF THE INVENTION
Embodiments of the present invention solve the above-described problems by providing a method, system, and apparatus for easily converting numbers between measurement systems and units that do not require the use of an external application or Web site to convert the numbers. Moreover, embodiments of the present invention provide a method, system, and apparatus for converting numbers between units that can present conversion options to the user in a user-selected interface language. Moreover, embodiments of the invention provide an extensible architecture through which a user may add conversion rules that enable conversion of numbers between measurement systems not initially supported.
According to one actual embodiment of the present invention, a method is provided for converting a number between measurement systems in a system for creating and editing an electronic document. According to this embodiment of the invention, software modules are executed in conjunction with a software application for creating and editing an electronic document that allow the convenient conversion of numbers between measurement units. When a user types a string of text, such as a paragraph into the software application, the string is analyzed to determine whether the string of text includes a number having an associated unit name. For instance, a user may type the number “10” and the associated unit name “km”, for kilometers. If the string of text includes a number having an associated unit name, the number is semantically labeled with schema information that identifies the unit name as a source unit of measure. For instance, if a string of text includes the number “10” followed by the unit of measure “km”, schema information will be associated with the number indicating that the number is expressed with a source unit of measure.
Once a number having an associated unit name has been identified within a string of text, such as a paragraph, the application may display an indication to the user that the number has been semantically labeled. This indication also identifies to the user that actions may be performed on the number. When a selection is received of the number or the indication, a list of actions may be provided to the user identifying conversion options available for the number. For instance, if the identified number includes an associated unit name “m”, for meters, an action menu item may be displayed to the user for converting the number to feet or yards. Other types of conversion options may also be presented to the user for converting the number.
According to one embodiment of the invention, a current user interface language setting for the application program is determined prior to providing the list of actions to the user. When the user selects the list of actions, the available actions are displayed to the user in a language specified by the current user interface language setting. In this manner, the user is always presented the conversion options in the current user interface language. Actions may also be included in the list of actions only for conversions supported for the current user interface language setting and may also be specified as being enabled for use with all user interface languages.
After the list of actions has been displayed to the user, a selection of one of the actions may be received. In response to receiving the selection of a conversion action, a converted number may be generated by converting the selected number to the destination unit of measure identified by the selected action. Once the conversion is completed, the converted number and its associated unit name may be inserted into the string of text to replace the selected number and its associated unit name. According to various embodiments of the present invention, a document object model supported by the application program may be utilized to insert the converted number into the string of text. Alternatively, the converted number may be displayed to the user.
According to another embodiment of the present invention, a system is provided for converting a number between measurement systems. According to this embodiment of the invention, the system includes a recognizer plug-in capable of receiving a portion of an electronic document as a string of text from an application program. For instance, the recognizer plug-in may receive a paragraph of text from an application program as it is typed by the user. Once the recognizer plug-in has received the string of text, the recognizer plug-in analyzes the string of text to determine whether the string of text includes a number having an associated unit name. If the string of text includes a number having an associated unit name, the recognizer plug-in semantically labels the number with schema information identifying the unit name as a source unit of measure and identifying the language used to express the string of text. This information is then passed by the recognizer plug-in back to the application program.
According to one embodiment of the invention, the system also includes an application program for creating and editing an electronic document. For instance, the application program may comprise a word processor, a spreadsheet application program, an e-mail application which includes editing functions, or other types of application programs for creating and editing electronic documents. According to this embodiment of the invention, the application program is capable of displaying the string of text along with an indication that the number has been semantically labeled by the recognizer plug-in. This indication may comprise a user interface object for indicating to a user that the number has been semantically labeled and that conversion actions may be performed on the number.
The application program may also be operative to receive a selection of the number or the indication and to provide a list of actions that may be performed on the number to convert the number to another measurement unit. The application may then receive the selection of one of the list of actions and provide the selection and the number to an action plug-in.
The system also includes an action plug-in that is capable of generating a converted number by converting the selected number to the destination unit of measurement identified by action selected from the list of actions. The action plug-in is also operative to replace the selected number and its associated unit name with the converted number and its associated unit name in the string of text. According to one actual embodiment of the invention, the action plug-in may replace the number with the converted number in the string of text by accessing a document object model provided by the application program. Alternatively, the converted number and its associated unit name may be displayed.
According to various embodiments of the present invention, the system provided herein may also include an action plug-in that is operative to register with the application program prior to performing any conversion functions. As a part of the registration procedure, the action plug-in may provide the list of actions that may be performed on the number to convert the number to another measurement system to the application program. Moreover, when creating the list of actions, the action plug-in may determine a current user interface language setting for the application program and generate the action menu items in a language specified by the current user interface language setting. Additionally, the action plug-in may also consult a conversion settings file to generate action menu items for each source unit name enabled for use with all enabled languages and for each source unit name enabled for use with the current user interface language. The contents of the conversion settings file may be modified by a user to enable conversion between measurement systems other than those initially defined in the conversion settings file.
Other embodiments of the present invention provide a computer-controlled apparatus and a computer-readable medium for converting numbers between measurement systems based on semantically labeled strings. These and other details regarding the various embodiments of the invention will become more apparent from the detailed description that follows.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1A is a block diagram showing the architecture of a personal computer that provides an illustrative operating environment for embodiments of the present invention;
FIG. 1B is a block diagram showing the format and contents of a conversion settings file utilized in various embodiments of the present invention to define available conversions;
FIG. 2 is a block diagram that shows a software architecture for recognizing, labeling, and performing actions on recognized strings of text according to various embodiments of the present invention;
FIGS. 3A-3D are screen diagrams showing screen displays including an action menu for converting numbers between measurement systems provided by various embodiments of the present invention;
FIG. 4 is a flow diagram showing an illustrative routine for registering an action plug-in with an application program according to one actual embodiment of the present invention;
FIG. 5 is a flow diagram showing an illustrative routine for processing a string input provided at an application program according to one actual embodiment of the present invention;
FIG. 6 is a flow diagram illustrating the operation of a recognizer plug-in software module provided according to one actual embodiment of the present invention;
FIG. 7 is a flow diagram illustrating a routine for processing the selection of a semantically categorized number according to one actual embodiment of the present invention; and
FIG. 8 is a flow diagram showing a routine for executing an action plug-in for converting numbers between measurement units according to one actual embodiment of the present invention.



DETAILED DESCRIPTION OF AN ILLUSTRATIVE EMBODIMENT
As described briefly above, embodiments of the present invention provide a method, system, apparatus, and computer-readable medium for converting numbers between units of measure. In the following detailed description, references are made to the accompanying drawings that form a part hereof, and in which are shown by way of illustration specific embodiments or examples. These embodiments may be combined, other embodiments may be utilized, and structural changes may be made without departing from the spirit and scope of the present invention. The following detailed description is, therefore, not be taken in a limiting sense, and the scope of the present invention is defined by the appended claims and their equivalents.
Referring now to the drawings, in which like numerals represent like elements through the several figures, aspects of the present invention and the illustrative operating environment will be described. FIG. 1A and the following discussion are intended to provide a brief, general description of a suitable computing environment in which the invention may be implemented. While the invention will be described in the general context of program modules that execute in conjunction with an application program that runs on an operating system on a personal computer, those skilled in the art will recognize that the invention may also be implemented in combination with other program modules. Additional aspects of an illustrative operating environment and software architecture for implementing the various embodiments of the present invention are described in U.S. patent application Ser. No. 09/588,411, entitled “Method and System for Semantically Labeling Strings and Providing Actions Based on Semantically Labeled Strings”, which is expressly incorporated herein by reference.
Generally, program modules include routines, programs, components, data structures, and other types of structures that perform particular tasks or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like. 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 memory storage devices.
Turning now to FIG. 1A, an illustrative computer architecture for a personal computer 2 for practicing the various embodiments of the invention will be described. The computer architecture shown in FIG. 1A illustrates a conventional personal computer, including a central processing unit 4 (“CPU”), a system memory 6, including a random access memory 8 (“RAM”) and a read-only memory (“ROM”) 10, and a system bus 12 that couples the memory to the CPU 4. A basic input/output system containing the basic routines that help to transfer information between elements within the computer, such as during startup, is stored in the ROM 10. The personal computer 2 further includes a mass storage device 14 for storing an operating system 16, application programs, such as the application program 205, and data.
The mass storage device 14 is connected to the CPU 4 through a mass storage controller (not shown) connected to the bus 12. The mass storage device 14 and its associated computer-readable media provide non-volatile storage for the personal computer 2. Although the description of computer-readable media contained herein refers to a mass storage device, such as a hard disk or CD-ROM drive, it should be appreciated by those skilled in the art that computer-readable media can be any available media that can be accessed by the personal computer 2.
By way of example, and not limitation, computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and non-volatile, 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, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical 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 the computer.
According to various embodiments of the invention, the personal computer 2 may operate in a networked environment using logical connections to remote computers through a TCP/IP network 18, such as the Internet. The personal computer 2 may connect to the TCP/IP network 18 through a network interface unit 20 connected to the bus 12. It should be appreciated that the network interface unit 20 may also be utilized to connect to other types of networks and remote computer systems. The personal computer 2 may also include an input/output controller 22 for receiving and processing input from a number of devices, including a keyboard or mouse (not shown). Similarly, an input/output controller 22 may provide output to a display screen, a printer, or other type of output device.
As mentioned briefly above, a number of program modules and data files may be stored in the mass storage device 14 and RAM 8 of the personal computer 2, including an operating system 16 suitable for controlling the operation of a networked personal computer, such as the WINDOWS XP operating system from MICROSOFT CORPORATION of Redmond, Wash. The mass storage device 14 and RAM 8 may also store one or more application programs. In particular, the mass storage device 14 and RAM 8 may store an application program 205 for creating and editing an electronic document 24. For instance, the application program 205 may comprise a word processing application program and the electronic document 24 may comprise a word processing document. The application program 205 may also comprise a spreadsheet application program and the electronic document 24 comprise a spreadsheet. Similarly, the application program 205 may comprise an electronic mail application program and the electronic document 24 may comprise an electronic mail message. Application programs for creating and editing other types of electronic documents may also be used with the various embodiments of the present invention.
Embodiments of the present invention provide program modules for use in conjunction with the application program 205 that convert numbers contained within the electronic document 24 between units of measure, also referred to herein as measurement units or measurement systems. In particular, embodiments of the invention provide a recognizer plug-in 220 and an action plug-in 225. As will be described in greater detail below, the recognizer plug-in 220 recognizes numbers having an associated unit name contained within an electronic document 24 and labels the numbers with semantic information identifying the unit name as a source unit of measure. The recognizer plug-in 220 then passes this information to the application program 205 for use by the action plug-in 225. The action plug-in 225 performs actions on the recognized numbers for converting between units of measure. The available conversions are defined in the conversion settings file 28. Additional details regarding the conversion settings file 28 are described below with reference to FIG. 1B.
According to various embodiments of the present invention, the action plug-in 225 may also generate a list of actions that may be performed on a given number. As a part of this process, the action plug-in 225 may query language settings 26 of the application program 205 or operating system 16. The language settings 26 specify the current user interface language. The list of actions may then be created in the current user interface language. Moreover, the action plug-in 225 may also consult the conversion settings file 28 to generate action menu items for each source unit name enabled for use with all enabled languages and for each source unit name enabled for use with the current user interface language. Additional details regarding the operation of the recognizer plug-in 220 and the action plug-in 225, including the use of the conversion settings file 28 and the language settings 26, will be described in greater detail below.
Referring now to FIG. 1B, various aspects of the conversion settings file 28 will be described. As discussed briefly above, the conversion settings file 28 is utilized by both the recognizer plug-in 220 and the action plug-in 225. In particular, the recognizer plug-in 220 utilizes portions of the conversion settings file 28 to determine the source unit names that should be recognized within a string of text, and the action plug-in 225 utilizes the conversion settings file 28 to create the action menus that should be presented to the user and to actually perform conversions. Additional details regarding the use of the conversion settings file 28 by the recognizer plug-in 220 and the action plug-in 225 will be described in greater detail below.
As shown in FIG. 1B, the conversion settings file 28 comprises a data file having fields 50A-50J. The field 50A contains a locale identification (“LCID”) number for which a particular conversion should be enabled. As known to those skilled in the art, when used in conjunction with the WINDOWS XP operating system from MICROSOFT CORPORATION of Redmond, Wash., the LCID is an identification number used to identify locales and languages. The LCID is used herein to ensure that conversion options will be presented to the user only for conversions that are enabled for use with the currently enabled language. Alternatively, the field 50A may include the phrase “ALL”, thereby enabling the conversion for use with all enabled languages. Additional details regarding the use of the field 50A will be described below.
The conversion settings file 28 also includes a field 50B representing the source unit name. The source unit name is the name of the source unit of measure that is associated with a recognized number. The recognizer plug-in 220 uses the field 50B to identify those source unit names that it should recognize. The conversion settings file 28 also includes a field 50C that includes a source description corresponding to the source unit name identified in the field 50B. The contents of the field 50C may be localized for a particular locale. The conversion settings file 28 also includes a field 50D that indicates whether a space is located between the source unit name and number. Some regional formats utilize a space between a number and a unit name while others do not. The field 50D is therefore utilized by the recognizer plug-in 220 to recognize numbers expressed using either format. The conversion settings file 28 also includes a field 50E that defines whether the case of the source unit name should be considered by the recognizer plug-in 220.
The conversion settings file 28 also includes the field 50F which contains data identifying the destination unit name and a field 50G which contains data identifying the destination description. As with the field 50C, the field 50G may be localized for a particular locale. A field 50H is also included that indicates whether a space should be placed between the destination number and its associated unit name in the conversion result. The field 50H is utilized by the action plug-in 225 when formatting conversion results.
The conversion settings file 28 also includes a field 50I indicating the number of decimal places that should be utilized when rounding the converted result. The field 50I may be changed for each conversion. Typically, the rounding precision value contained in field 50I is adjusted for conversions where the destination value is much larger or much smaller than the source number.
The conversion settings file 28 also includes a field 50J which defines the conversion ratio or formula reference that should be utilized for a particular conversion. Where a conversion is performed by multiplying by a coefficient, the field 50J contains the coefficient. Where a conversion is performed utilizing a more complex equation, the field 50J may include a formula reference to the appropriate formula. For instance, the field 50J may include a reference to a formula for converting Celsius values to Fahrenheit values, such as “CTOF”. Other types of formula references may also be provided for performing more complex conversions.
The conversion settings file 28 shown in FIG. 1B includes several illustrative conversion entries 52A-52E. The entry 52A corresponds to a conversion from kilometers to miles and is enabled for all languages. The entry 52B corresponds to a conversion from degrees Celsius to degrees Fahrenheit and is also enabled for all languages. The entries 52C-52D convert between Swedish “long” miles and kilometers and are only enabled when the active user interface language corresponds to the LCID “1054.” The entry 52E corresponds to a conversion from kilometers to yards and is also enabled for all languages.
It should be appreciated by the reader that the entries 52A-52E are merely illustrative examples of the types of conversions that may be defined in the conversion settings file 28 and that other types of conversions may be similarly defined. In particular, conversions may be defined between miles and kilometers, inches and centimeters, millimeters and inches, feet and centimeters, meters and feet, yards and meters, acres and hectare, U.K. pints and liters, U.S. pints and liters, liters and gallons, ounces and deciliters, quarts and liters, pounds and kilograms, miles per hour and kilometers per hour, and other measurement units. Moreover, it should be appreciated that additional conversions may be defined by adding an appropriate entry to the conversion settings file 28 defining the new conversion.
Referring now to FIG. 2, an illustrative software architecture for use in conjunction with the various embodiments of the present invention will be described. The architecture shown in FIG. 2 includes an application program 205, such as a word processor application program, a spreadsheet application program, or other type of application program for creating and editing electronic documents. The application program 205 may also comprise a Web browser.
The application program 205 is able to communicate with a recognizer dynamically linked library (“DLL”) 210 and an action DLL 215. As will be described in greater detail below, the recognizer DLL 210 controls one or more recognizer plug-ins 220A-220N and the action DLL 215 controls one or more action plug-ins 225A-225N.
According to one embodiment of the invention, the recognizer plug-ins 220A-220N and the action plug-ins 225A-225N are automation servers. Automation servers are well-known software components that are assembled into programs or add functionality to existing programs running on the WINDOWS XP operating system from MICROSOFT CORPORATION of Redmond, Wash. Automation servers may be written in a variety of computing languages and can be plugged and unplugged from a program at runtime without having to recompile the program.
The recognizer DLL 210 handles the distribution of text strings from an electronic document being edited by the application program 205 to the individual recognizer plug-ins 220A-220N. The recognizer plug-ins 220A-220N recognize particular strings in an electronic document, such as a word processing document or a spreadsheet document. The recognizer plug-ins 220A-220N may be packaged with the application program module 205 or they may be written by third parties to recognize particular strings of interest. Typically, the recognizer DLL 210 passes strings to the recognizer plug-ins 220A-220N in single paragraphs or cell value increments. However, strings may be passed to the recognizer plug-ins 220A-220N in other sizes and formats.
As part of recognizing certain strings as including semantic information, the recognizer plug-ins 220A-220N determine which strings are to be labeled and how they are to be labeled. After receiving these results from the various recognizer plug-ins 220, the recognizer DLL 210 sends semantic categories to the application program module 205. According to one actual embodiment of the invention, a recognizer plug-in 220 is provided for recognizing strings as containing numbers having an associated unit name. According to this embodiment of the invention, the semantic category comprises schema information that identifies the unit name as a source unit of measure. The schema information may also include information identifying the language in which the string of text is expressed. This information is returned to the recognizer DLL 210 by the recognizer plug-in 220 along with other information that may be utilized by a corresponding action plug-in 225, such as a copy of the number, the source unit name, and the language that the string of text is expressed in. Additionally, the recognizer plug-in 220 may return information identifying the location of the number within the text string, including the length of the text string and the character number of the first letter of the number.
It should be appreciated that each of the recognizer plug-ins 220A-220N are executed separately. The recognizer DLL 210 is responsible for handling the asynchronicity that results from different recognizer plug-ins 220A-220N returning results at different times. In this manner, various types of data may be recognized within a text string and different actions provided for each semantically labeled string. Additional details regarding the operation of the recognizer plug-in 220 for recognizing numbers will be described below with reference to FIGS. 3-8.
After a string is labeled by a recognizer plug-in 220A-220N, schema information is sent to the application program module 205. A user of the application program module 205 may then execute actions that are associated with the schema information on the recognized string. The action DLL 215 manages the action plug-ins 225A-225N that are executed in order to perform the actions. As with the recognizer plug-ins 220A-22N, the action plug-ins 225A-225N may be packaged with the application program module 205 or written by third parties to perform particular actions that are of interest. The action plug-ins 225A-225N provide possible actions to be presented to the user based upon the schema information, or type label, associated with the string. As will be described in greater detail below, the list of actions provided to the user is dynamically generated for each schema type. This information is then provided to the application program 205 which displays the list of actions to the user when the string is selected.
After an action has been chosen from the list of actions, the action DLL 215 manages the appropriate action plug-in 225A-225N and passes the necessary information between the action plug-in and the application program module 205 so that the action plug-in may execute the desired action. Typically, the application program module 205 sends the action DLL 215 an automation request to invoke the action the user has selected. As will be described in greater detail below, according to one embodiment of the invention, an action plug-in 225 is provided that converts recognized numbers to other units of measure. Addition details regarding the operation of the action plug-in 225 and the schema information utilized to identify different source unit names will be described in greater detail below with reference to FIGS. 3-8.
Referring now to FIGS. 3A-3D, an illustrative user interface provided by the various embodiments of the present invention will be described. As shown in FIG. 3A, a number 32 including an associated unit name may be typed by a user into an application program 205, such as a word processor, as a part of a string of text. Once the user has provided the string of text, the string of text is provided to a recognizer plug-in 220 that recognizes numbers contained within the string of text, such as the number 32. The number 32 having an associated unit name identified by the recognizer plug-in 220 is identified to the application program module as a type of semantic information upon which actions may be performed. Therefore, the application program module 205 provides an indication to the user that actions may be performed on the number 32. This indication may be provided to the user by highlighting the number 32 or providing a user interface indication 34 in proximity to the number 32.
When the number 32 or the indication 34 is selected by a user, a list of actions is displayed that may be performed on the number to convert the number to another unit of measure. This list of actions may comprise a dropdown menu 36 having one or more menu items corresponding to the list of actions that may be performed on the number 32. According to one embodiment of the invention, the contents of the dropdown menu 36 may be displayed in one of many different languages. The language in which the dropdown menu 36 is displayed is based on a current interface user language for the application program module 205 or the operating system 16. In this manner, international users throughout the world will be displayed a dropdown menu 36 in their currently installed and active user interface language.
As shown in FIG. 3A, the dropdown menu 36 includes another indication of the number 32 to be converted. The dropdown menu 36 also includes a list of actions 38 that may be performed to convert the number 32 to other measurement systems. According to one embodiment of the invention, the list of actions 38 displayed in the dropdown menu 36 is limited to conversion options specified for use with the currently enabled user interface language on the personal computer 2. In this manner, actions for converting numbers not relevant to the currently enabled language of the personal computer 2 will not be shown in the dropdown menu 36.
As shown in FIG. 3A, the application program module 205 also adds menu items 44A and 44B to the dropdown menu 36. The selection of item 44A removes the semantic labeling from the selected text. Other recognized text in the same (or other) documents will remain labeled, and newly typed text will still be subject to continued recognition and labeling. The selection of item 44B provides a list of user selectable preferences defining the operation and behavior of the recognizer and action plug-ins.
As described briefly above, when a number 32 having an associated unit name is recognized by the recognizer plug-in 220, the number 32 is labeled with schema information identifying the associated unit name as a source unit of measure. Additionally, the language of the string of text may also be identified in the schema information. This schema information is then returned to the application program 205 and is utilized by the action plug-in 225 to determine the appropriate list of actions 38 that should be included in the dropdown menu 36. In this manner, only conversion operations consistent with the source unit of measure and the language used to express the string of text are provided to the user via the dropdown menu 36.
The number 32 shown in FIG. 3A is expressed in kilograms. Therefore, the dropdown menu 36 includes actions in the list of actions 38 for converting the number 32 to pounds, and to stones and pounds. Similarly, the number 32 shown in FIG. 3B is expressed in meters. Therefore, the dropdown menu 36 includes actions in the list of actions 38 for converting the number 32 to feet and to yards. Likewise, the number 32 shown in FIG. 3D is shown degrees Celsius. Therefore, the dropdown menu 36 includes only an action for converting the number 32 from degrees Celsius to degrees Fahrenheit. Also, the list of actions 38 shown in FIGS. 3A, 3B, and 3D is displayed English. It should be appreciated, however, that the dropdown menu 36 would appear in another language if a language other than English was selected as the current user interface language on the personal computer 2.
As shown in FIG. 3C, once the user has selected an action from the list of actions 38, the conversion of the number 32 is performed according to the selected action. The converted number may then be displayed to the user in a dialog box 37 as shown in FIG. 3C. Alternatively, the number 32 may be replaced in the string of text with the converted number and the unit name associated with the destination unit of measurement. The number 32 may be replaced in the string of text using a document object model provided by the application program 205. This process is described in greater detail below. Additionally, as will be discussed in greater detail below, the application program 205 receives most of the text shown in the dropdown menu 36 from the action plug-in 225. This process occurs when the application program 205 is initially executed and the action plug-in 225 registers itself with the application program 205. Additional details regarding this registration process will be described below with reference to FIG. 4.
Referring now to FIG. 4, an illustrative routine 400 will be described for registering the number conversion software components with the application program 205. In particular, when the action plug-in 225 and the recognizer plug-in 220 for converting numbers are first executed, they are registered with the application program 205. By registering with the application program 205, the application program 205 is made aware of the software components and enabled for use with the schema types recognized by the recognizer plug-in 220. Moreover, the action items to be displayed to the user corresponding to each schema type are also enumerated to the application program 205 so that the application program 205 can display the dropdown menu 36 when a number 32 or indicator 34 is selected by a user.
The routine 400 begins at block 402, where the current user interface language is identified. As discussed briefly above, the current user interface language may be stored in the language settings 26 maintained by the operating system 16 or the application program 205. Once the current user interface language has been identified, the routine 400 continues to block 404. At block 404, the action plug-in 225 consults the conversion settings file 28, and generates action menu items for defined conversions that are specified for operation with all languages. In particular, the action plug-in 225 creates action menu items for all defined conversions that include the phrase “ALL” in the field 50A of the conversion settings file 28. The routine 400 then continues to block 406.
At block 406, action menu items are also generated for each defined conversion that has an entry in field 50A corresponding to the current user interface language. In this manner, action menu items are generated only for those conversions enabled for use with all user interface languages and for those conversions enabled for use with the current user interface language. It should be appreciated that the action menu items are generated on a per source unit name basis. In this manner, many separate dropdown menus 36 may be generated, one for each source unit name. Moreover, a separate schema name is utilized for each source unit name and current user interface language. In this manner, regardless of the source unit name or current user interface language, an appropriate dropdown menu 36 will be presented.
From block 406, the routine 400 continues to block 408, where the action menu items for each schema are returned to the application program 205. According to one embodiment of the invention, the application program 205 displays the dropdown menu 36 in response to the selection of a number 32 or an indicator 34. However, it should be appreciated that the action plug-in 225 or other software component may be responsible for the display of the dropdown menu 36. The routine 400 continues from block 408 to block 410, where it ends.
Turning now to FIG. 5, an illustrative routine 500 will be described for processing the input of a new string at the application program 205. The routine 500 begins at block 502, where the application program 205 receives a new string, such as when a user enters a new paragraph into an electronic document or edits a previously entered paragraph. From block 502, the routine 500 continues to block 504 where the application program 205 passes the new string to the recognizer DLL 210. As described above, the recognizer DLL 210 is responsible for communicating with the application program 205, managing the jobs that need to be performed by the recognizer plug-ins 220A-220N, receiving results from the recognizer plug-ins 220A-220N, and sending schema information to the application program module 205 for recognized numbers and source unit names. It should be understood that, in one embodiment of the invention, a paragraph is passed to the recognizer DLL 210 at block 504. However, in alternative embodiments, a sentence, the contents of a spreadsheet cell, a section of the document, the entire document, etc., may be passed to the recognizer DLL 210. In other words, it should be appreciated that the embodiments of the present invention are not limited to simply passing a paragraph to the recognizer DLL 210.
From block 504, the routine 500 continues to block 506, where the recognizer DLL 210 passes the string to the recognizer plug-ins 220A-220N. The routine 500 then continues to block 508 where the recognizer plug-ins are executed on the paragraph to recognize key words or characters within the string. In particular, the recognizer plug-in for converting numbers between measurement systems is executed on the string. An illustrative routine describing the operation of the recognizer plug-in for number conversion is described below with reference to FIG. 6.
At block 510, the results from the recognizer plug-in 220 are received at the recognizer DLL 210. The routine 500 then continues to block 512, where a determination is made by the recognizer DLL 210 as to whether the paragraph has been edited since the string was transmitted to the recognizer plug-ins 220A-220N. If the paragraph has been edited, the routine 500 returns to block 504, where the edited string is passed to the recognizer DLL 210. If the paragraph has not been edited, the routine 500 continues to block 514, where the recognizer DLL 210 sends the results received from the recognizer plug-in 220 to the application program 205. The routine 500 then continues to block 516, where it ends.
Referring now to FIG. 6, an illustrative routine 600 will be described that illustrates the operation of the recognizer plug-in 220 for converting numbers between units of measure according to one embodiment of the present invention. The routine 600 begins at block 602, where a string of text is received at the recognizer plug-in 220 from the recognizer DLL 210. The routine 600 then continues to block 604, where a determination is made as to whether the string of text contains a number.
From block 604, the routine 600 continues to block 606, where a determination is made as to whether a number was found in the string of text. If no digits were found, the routine 600 branches from block 606 to block 614, where it returns to block 510, shown in FIG. 5. If, however, at block 606, it is determined that digits were found in the string of text, the routine 600 continues to block 608.
At block 608, text located after the identified digits is scanned to determine whether a source unit name is associated with the number. For example, the recognizer plug-in 220 may scan the text after the identified digits for the source unit names “km”, “lb”, “mi”, and other source unit names. The list of the source unit names that the recognizer plug-in 220 searches for is defined by the field 50B of the conversion settings file 28.
From block 608 the routine 600 continues to block 610 where a determination is made as to whether a source unit name associated with the recognized number was located. If no source unit name was found, the routine 610 branches to block 614, where it returns to block 510, shown in FIG. 5. If a source unit name was found that is associated with the recognized number, the routine 600 continues to block 612.
At block 612, schema information is returned to the recognizer DLL 210. In particular, a schema name associated with the source unit name and the currently enabled language is returned to the recognizer DLL 210. Additionally, a “property bag” may also be returned to the recognizer DLL 210. The property bag is an object which stores information about the recognized number that may be utilized by the action plug-in 225. For instance, the property bag may include a format number indicating generally which format the recognized number was written in. Additionally, an index to the recognized number within the string of text may also be returned to the recognizer DLL 210. All of the information returned from the recognizer plug-in 220 to the recognizer DLL 210 may be subsequently passed to the action plug-in 225 and used in the conversion process. This is described in greater detail below with respect to FIGS. 7 and 8. From block 612, the routine 600 continues to block 614, where it returns to block 510, shown in FIG. 5.
Referring now to FIG. 7, an illustrative routine 700 will be described for processing the selection of a semantically categorized number having an associated unit name. As discussed above, once a number has been recognized within a string of text by the recognizer plug-in 220A as having an associated unit name, the number may be highlighted or an indication may be provided to the user indicating that the number has been recognized and that actions may be performed on the number. Accordingly, at block 702, a determination is made as to whether the number or indicator has been selected by a user. If the number has not been selected, the routine 700 continues to block 714, where it ends. If, however, the number or indicator has been selected, the routine 700 continues to block 704.
At block 704, the application program 205 displays the list of actions associated with the schema corresponding to the selected number. In this manner, the dropdown menu 36 described above with reference to FIG. 3A is presented to the user. The routine 700 then continues from block 704 to block 706, where a determination is made as to whether the user has selected one of the items from the list of actions. If the user has made the selection of a user interface item other than one of the items from the list of actions, the routine 700 branches to block 710, where the list of actions is removed. If, however, the user does select one of the items from the list of actions, the routine 700 continues to block 708.
At block 708, the application program 205 calls the action plug-in 225 corresponding to the appropriate schema type and indicates that an action item has been selected. The call from the application program 225 to the action plug-in 225 includes the schema name corresponding to the recognized number, the item number of the selected menu item, the name of the calling application program 205, a pointer into an object model provided by the application program 205 for accessing the document 24, the property bag described above with reference to FIG. 6, and the text of the recognized number. The routine 700 then continues to block 712, where the action plug-in for converting numbers between measurement units is executed. An illustrative routine for executing the action plug-in 225 for number conversion is described below with reference to FIG. 8. Once the action plug-in 225 has completed its execution, the routine 700 continues from block 712 to block 714, where it ends.
Referring now to FIG. 8, an illustrative routine 800 will be described for executing an action plug-in 225 for converting numbers between measurement systems. The routine 800 begins at block 802, where the action plug-in 225 receives a call from the action DLL 215 indicating that the user has selected an action menu item. From block 802, the routine 800 continues to block 804, where the action plug-in 225 determines the actual value of the recognized number in view of a format associated with the language in which the string containing the number is expressed. This is necessary because numbers expressed in different languages may include separator characters that have different meanings in different languages. For instance, a number may be expressed in French as “1,729”, while in English it would be expressed as “1729.” Therefore, at block 804, the action plug-in 225 identifies the regional format for the number from the language settings file 26 based on the language in which the number is expressed. Using the regional format, the actual value of the number can be determined.
From block 804, the routine 800 continues to block 806, where the recognized number is converted to the destination unit of measure according to the selected action menu item. In particular, the value of the field 50J of the conversion settings file 28 for the selected conversion may be utilized to convert the recognized and selected number. The value of the field 50I in the conversion settings file 28 may also be utilized to round the converted number to the appropriate number of digits.
From block 806, the routine 800 continues to block 808, where the converted number is formatted. The converted number may be formatted according to the regional format specified in the language settings file 26. Moreover, the value of field 50H in the conversion settings file 28 may be utilized to format the spacing between the converted number and the destination unit name. Other types of formatting may also be applied to the converted number.
From block 808, the routine 800 continues to block 810 where the number in the string of text is replaced with the converted number. According to one embodiment of the present invention, the replacement is made by accessing a document object model provided by the application program 205. Through the document object model, the action plug-in 225 can directly access the document 24 and make changes therein. Details regarding the use of such a document object model are well known to those skilled in the art. Alternatively, the converted number and its associated unit name may be displayed to the user. From block 810, the routine 800 continues to block 812, where it returns to block 714, described above with reference to FIG. 7.
Based on the foregoing, those skilled in the art should appreciate that various embodiments of the present invention provide a method, system, apparatus, and computer-readable medium for converting numbers between units of measure based upon semantically labeled strings. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.

## Claims

1. In a system for creating and editing an electronic document, a method to be executed by a plurality of software programs encoded on a computer-readable medium for converting a number between two systems of measurement, the method comprising:
receiving a portion of the electronic document as a string of text;
analyzing the string of text to determine whether the string of text includes a number having an associated unit name;
in response to determining that the string of text includes a number having an associated unit name, semantically labeling the number with schema information identifying the unit name as a source of measure, wherein the semantic labeling becomes part of the electronic document;
automatically determining a current user interface language setting for an application program associated with the electronic document;
displaying the number and the unit name and an indication that the number has been semantically labeled;
receiving, from a user, a selection of the number or the indication;
in response to receiving the selection of the number or the indication, displaying, to the user, a list of actions in a language specified by the current user interface language setting that are to be performed on the number to convert the number to a destination unit of measure, the list of actions identified based upon the schema information;
receiving, from the user, the selection of an action from the list of actions;
in response to receiving the selection of an action, determining a value for the number based upon a format associated with a language in which the string of text is expressed, if the selected action is associated with converting the number;
generating a converted number by converting the value to the destination unit of measure identified by the selected action;
replacing the number with the converted number in the string of text; and
if the selected action is associated with removing the semantic labeling, removing the semantic labeling from the electronic document.

2. The method of claim 1, wherein operating a converted number by converting the number from the source unit of measure to the destination unit of measure identified by the selected action comprises:
retrieving from a conversion settings file a conversion ratio or formula corresponding to the selected action; and
generating a converted number by converting the number from the source unit of measure to the destination unit of measure with the conversion ratio or formula.

3. The method of claim 2, wherein the conversion settings file comprises a conversion ratio or formula corresponding to one or more measurement conversions, and wherein the method further comprises receiving from a user a user-defined conversion ratio or formula and storing the user-defined ratio or formula in the conversion settings file.

4. The method of claim 1, further comprising:
replacing the number and the associated unit name with the converted number and a unit name associated with the destination unit of measure.

5. The method of claim 4, wherein replacing the number and the associated unit name with the converted number and a unit name associated with the destination unit of measure comprises utilizing a document object model provided by an application for editing the electronic document to replace the number and the associated unit name with the converted number and a unit name associated with the destination unit of measure.

6. The method of claim 5, wherein the list of actions comprises a dropdown menu having one or more menu items corresponding to the list of actions that are to be performed on the number to convert the number to the destination unit of measure.

7. The method of claim 6, further comprising:
displaying the list of actions in the language specified by the current user interface language setting by generating menu items of the dropdown menu in the language specified by the current user interface language setting.

8. The method of claim 7, further comprising:
generating at least one menu item enabled for use with at least one language different from the language specified by the current user interface language setting.

9. The method of claim 8, further comprising displaying the number and an indication that the number has been semantically labeled, and wherein the list of actions is provided in response to the selection of the number or the indication.

10. The method of claim 9, wherein the schema information comprises data uniquely corresponding to the source unit of measure and the language specified by the current user interface language setting.

11. The method of claim 10, further comprising:
determining a value of the number prior to converting the number based upon a format associated with the language in which the string of text is expressed.

12. The method of claim 1, wherein the list of actions comprises a dropdown menu having one or more menu items corresponding to the list of actions that are to be performed on the number to convert the number to the destination unit of measure.

13. The method of claim 12, further comprising:
displaying the list of actions in the language specified by the current user interface language setting by generating menu items of the dropdown menu in the language specified by the current user interface language setting.

14. The method of claim 13, further comprising:
generating at least one menu item enabled for use with at least one language different from the language specified by the current user interface language setting.

15. A system embodied on a computer-readable medium for converting a number between two systems of measurement, the system comprising:
a recognizer plug-in capable of receiving a portion of an electronic document as a string of text from an application program, analyzing the string of text to determine whether the string of text includes a number having an associated unit name, in response to determining that the string of text includes a number having an associated unit name, semantically labeling the number with schema information identifying the unit name as a source unit of measure and identifying the language used to express the string of text, wherein the semantic labeling becomes part of the electronic document, and automatically determining a current user interface language setting for the electronic document;
an application program for creating and editing the electronic document, the application program capable of displaying the string of text and an indication that the number has been semantically labeled, receiving a selection of the number or the indication, in response to receiving the selection of the number or the indication, displaying, to a user, a list of actions in a language specified by the current user interface language setting that are to be performed on the number to convert the number to a destination unit of measure, the list of actions identified based upon the schema information, receiving the selection of an action from the list of actions, and providing the selected action and the number to an action plug-in; and
an action plug-in capable of generating a converted number by converting the number to the destination unit of measure identified by the selected action, and replacing the number with the converted number and a unit name corresponding to the destination unit of measure in the string of text, if the selected action is associated with converting the number, and if the selected action is associated with removing the semantic labeling, removing the semantic labeling from the electronic document.

16. The system of claim 15, wherein the list of actions comprises a dropdown menu having one or more menu items corresponding to the list of actions that are to be performed on the number to convert the number to the destination unit of measure, and wherein the action plug-in is further operative to:
generate the menu items of the dropdown menu in the language specified by the current user interface language setting.

17. The system of claim 16, wherein the action plug-in is further operative to identify one or more enabled languages for the application program and to generate at least one menu item enabled for use with at least one language different from the language specified by the current user interface language setting, and to generate at least one menu item enabled for use with the language specified by the current user interface language setting.