# Patent

## Title
Representing spelling and grammatical error state in an XML document

## Abstract

The present invention provides markers for spelling and grammar errors and the proofing state of a word-processing document stored as an XML file. The markers are used to show where a spelling or grammar error has occurred within the document. The proof state indicates whether the document been fully checked for spelling or grammatical errors.

## Background
RELATED APPLICATIONS
This patent application is a continuation-in-part application under 35 United States Code §120 of U.S. patent application Ser. No. 10/187,060 filed on Jun. 28, 2002, which is incorporated herein by reference. An exemplary schema in accordance with the present invention is disclosed beginning on page 11 in an application entitled “Mixed Content Flexibility,” Ser. No. 10/726,077, filed Dec. 2, 2003, which is hereby incorporated by reference in its entirety.


BACKGROUND OF THE INVENTION
Markup Languages have attained wide popularity in recent years. One type of markup language, Extensible Markup Language (XML), is a universal language that provides a way to identify, exchange, and process various kinds of data. For example, XML is used to create documents that can be utilized by a variety of application programs. Elements of an XML file have an associated namespace and schema.
In XML, a namespace is a unique identifier for a collection of names that are used in XML documents as element types and attribute names. The name of a namespace is commonly used to uniquely identify each class of XML document. The unique namespaces differentiate markup elements that come from different sources and happen to have the same name.
XML Schemata provide a way to describe and validate data in an XML environment. A schema states what elements and attributes are used to describe content in an XML document, where each element is allowed, what types of text contents are allowed within it and which elements can appear within which other elements. The use of schemata ensures that the document is structured in a consistent manner. Schemata may be created by a user and generally supported by an associated markup language, such as XML. By using an XML editor, the user can manipulate the XML file and generate XML documents that adhere to the schema the user has created. XML documents may be created to adhere to one or more schemata.
Recently, some word processors have begun producing documents that are somewhat XML compatible. For example, some documents may be parsed using an application that understands XML. Many features of the word processor, however, are not stored within the XML file. For example, spelling and grammar state information is not stored within the XML file. What is needed is a way to store spelling and grammar state within an XML document.
SUMMARY OF THE INVENTION
The present invention is directed towards marking spelling and grammar errors and proofing state of a word-processing document within XML.
According to one aspect of the invention, markers are used to show where a spelling or grammar error has occurred within the document.
According to another aspect of the invention, the proof state of the document is also stored. For example, has the document been fully checked for spelling or grammatical errors.
According to another aspect of the invention, the word processing document stored as XML may be parsed by an application that understands XML even though it is not the creator of the document.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates an exemplary computing device that may be used in one exemplary embodiment of the present invention;
FIG. 2 is a block diagram illustrating an exemplary environment for practicing the present invention;
FIG. 3 illustrates an exemplary ML file;
FIG. 4 illustrates an exemplary ML file including markers for a grammar error;
FIG. 5 illustrates an exemplary ML file including markers for a spelling error; and
FIG. 6 illustrates an exemplary definition for a proof state element, in accordance with aspects of the invention.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
Throughout the specification and claims, the following terms take the meanings explicitly associated herein, unless the context clearly dictates otherwise.
The terms “markup language” or “ML” refer to a language for special codes within a document that specify how parts of the document are to be interpreted by an application. In a word-processor file, the markup language specifies how the text is to be formatted or laid out, whereas in a particular customer schema, the ML tends to specify the text's meaning according to that customer's wishes (e.g., customerName, address, etc. The ML is typically supported by a word-processor and may adhere to the rules of other markup languages, such as XML, while creating further rules of its own.
The term “element” refers to the basic unit of an ML document. The element may contain attributes, other elements, text, and other building blocks for an ML document.
The term “tag” refers to a command inserted in a document that delineates elements within an ML document. Each element can have no more than two tags: the start tag and the end tag. It is possible to have an empty element (with no content) in which case one tag is allowed.
The content between the tags is considered the element's “children” (or descendants). Hence other elements embedded in the element's content are called “child elements” or “child nodes” or the element. Text embedded directly in the content of the element is considered the element's “child text nodes”. Together, the child elements and the text within an element constitute that element's “content”.
The term “attribute” refers to an additional property set to a particular value and associated with the element. Elements may have an arbitrary number of attribute settings associated with them, including none. Attributes are used to associate additional information with an element that will not contain additional elements, or be treated as a text node.
Illustrative Operating Environment
With reference to FIG. 1, one exemplary system for implementing the invention includes a computing device, such as computing device 100. In a very basic configuration, computing device 100 typically includes at least one processing unit 102 and system memory 104. Depending on the exact configuration and type of computing device, system memory 104 may be volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.) or some combination of the two. System memory 104 typically includes an operating system 105, one or more applications 106, and may include program data 107. In one embodiment, application 106 may include a word-processor application 120 that further includes spelling and grammar application 122. This basic configuration is illustrated in FIG. 1 by those components within dashed line 108.
Computing device 100 may have additional features or functionality. For example, computing device 100 may also include additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in FIG. 1 by removable storage 109 and non-removable storage 110. Computer storage media may include 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. System memory 104, removable storage 109 and non-removable storage 110 are all examples of computer storage media. 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 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 computing device 100. Any such computer storage media may be part of device 100. Computing device 100 may also have input device(s) 112 such as keyboard, mouse, pen, voice input device, touch input device, etc. Output device(s) 114 such as a display, speakers, printer, etc. may also be included. These devices are well know in the art and need not be discussed at length here.
Computing device 100 may also contain communication connections 116 that allow the device to communicate with other computing devices 118, such as over a network. Communication connection 116 is one example of communication media. Communication media may typically be embodied by 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. The term computer readable media as used herein includes both storage media and communication media.
Word-Processor File Structure and Spelling and Grammar
Many word processors have built in spelling and grammar checking to assist users while editing their files. These are extremely powerful and popular features.
Storing the spelling and grammar state as XML, helps to make it possible to use other tools to look at the documents and tell the state of that document. Additionally, storing the states as XML helps to improve performance when opening the files using the word processor. If all the spelling and grammar errors are already marked, then the word processor does not have to pass over the entire document to check for spelling & grammar errors every time it is opened. It only needs to examine the areas that the user changes.
FIG. 2 is a block diagram illustrating an exemplary environment for practicing the present invention. The exemplary environment shown in FIG. 2 is a word-processor environment 200 that includes word-processor 120, ML file 210, ML Schema 215, and ML validation engine 225.
In one embodiment, word-processor 120 has its own namespace or namespaces and a schema, or a set of schemas, that is defined for use with documents associated with word-processor 120. The set of tags and attributes defined by the schema for word-processor 120 define the format of a document to such an extent that it is referred to as its own native ML. Word-processor 120 internally validates ML file 210. When validated, the ML elements are examined as to whether they conform to the ML schema 215. A schema states what tags and attributes are used to describe content in an ML document, where each tag is allowed, and which tags can appear within other tags, ensuring that the documentation is structured the same way. Accordingly, ML 210 is valid when structured as set forth in arbitrary ML schema 215.
ML validation engine 225 operates similarly to other available validation engines for ML documents. ML validation engine 225 evaluates ML that is in the format of the ML validation engine 225. For example, XML elements are forwarded to an XML validation engine. In one embodiment, a greater number of validation engines may be associated with word-processor 120 for validating a greater number of ML formats.
FIG. 3 illustrates an exemplary ML file in accordance with aspects of the present invention. ML file 300 includes ML elements. An element in a markup language usually includes an opening tag (indicated by a “<” and “>”), some content, and a closing tag (indicated by a “</” and “>”). In this example, tags associated with ML include a “me:” within the tag (e.g., 302). The “me:” prefix is used as shorthand notation for the namespace associated with the element.
There are enough ML elements for an application that understands XML to fully recreate the document from a single XML file. Hint tags may also be included that provide information to an application to help understand the content of the file. The text contained within the document follows the “text” tag, making it easy for an application to extract the text content from a word-processing document created in accordance with aspects of the invention.
Take an XML file that has the following sentence containing a grammatical error:
“I do be watching this.”
Also assume that the above sentence has an XML element <me:XML> applied to it around “be watching”, such that the output XML looks as illustrated in FIG. 3.
Given that the example shown is valid, ML file 210 produces a document with a paragraph that includes the text “I do be watching this” in the first paragraph.
The phrase “do be” should be flagged as a grammar error. In order to maintain well formedness, the XML tag representing the error start can not be placed outside of the <me:XML> tag and end inside of it. For example, the following is not well formed XML:
<para>
<run>

    
    
        <text>I</text>
    
    


</run>
<GrammarError>

    
    
        <run>
        
            <text>do</text>
        
        
        </run>
    
    


<me:XML>

    
    
        <run>
        
            <text>be</text>
        
        
        </run>
        </GrammarError>
        <run>
        
            <text>watching</text>
        
        
        </run>
    
    


</me:XML>
<run>

    
    
        <text>this</text>
    
    


</run>
</para>
FIG. 4 illustrates an exemplary ML file including markers for a grammar error, in accordance with aspects of the invention. As illustrated in FIG. 4, the ML file includes a single tag (402) to represent the start of the grammar error, and another single tag (404) to represent the end of the grammar error. According to one embodiment of the invention, the tag representing the start of the grammar error is <proofErr type=“GrammarStart”/> and the tag representing the end of the grammar error is <proofErr type=“GrammarEnd”/>. Other tags may be used.
The following list is an exemplary list of proofErr types:
<xsd:simpleType name=“proofErrType”>
<xsd:restriction base=“xsd:string”>

    
    
        <xsd:enumeration value=“spellStart”></xsd:enumeration>
        <xsd:enumeration value=“spellEnd”>
        
            <xsd:annotation>
            
                <xsd:documentation>The spelling error is contained within spellStart and spellEnd.</xsd:documentation>
            
            
            </xsd:annotation>
        
        
        </xsd:enumeration>
        <xsd:enumeration value=“gramStart”></xsd:enumeration>
        <xsd:enumeration value=“gramEnd”>
        
            <xsd:annotation>
            
                <xsd:documentation>The grammar error is contained within gramStart and gramEnd.</xsd:documentation>
            
            
            </xsd:annotation>
        
        
        </xsd:enumeration>
    
    


</xsd:restriction>
</xsd:simpleType>
FIG. 5 illustrates an exemplary ML file including markers for a spelling error, in accordance with aspects of the invention. As illustrated in FIG. 5, the ML file includes a single tag (502) to represent the start of the spelling error, and another single tag (504) to represent the end of the spelling error.
FIG. 6 illustrates an exemplary definition for a proof state element, in accordance with aspects of the invention. The proof state of the document indicates whether the document has been fully checked for spelling & grammar errors. The proof state helps to make it possible to ignore a spelling error and save. When the file is reopened, the spelling error is still ignored. If proof state did not exist, the word processor would not know if the document has already been checked for spelling mistakes, and would therefore re-flag the error.
According to one embodiment, the ignored spelling error is not marked, and would, therefore, be re-flagged if there were no state information. A spelling error is explicitly marked with XML, but an ignored error has no marking. Any misspelling that is not flagged (when the proof state is clear), can be assumed to have already been ignored by the user.
The following is a commented definition for the proofState element that defines the state of the document:
<xsd:element name=“proofState” type=“proofProperty” minOccurs=“0”>
<xsd:annotation>

    
    
        <xsd:documentation>The state of proofing tools in this document.</xsd:documentation>
    
    


</xsd:annotation>
</xsd:element>
<xsd:complexType name=“proofProperty”>
<xsd:annotation>

    
    
        <xsd:documentation>The state of proofing tools in this document.</xsd:documentation>
    
    


</xsd:annotation>
<xsd:attribute name=“spelling” type=“proofType” use=“optional”>

    
    
        <xsd:annotation>
        
            <xsd:documentation>The state of the spell checker in this document.</xsd:documentation>
        
        
        </xsd:annotation>
    
    


</xsd:attribute>
<xsd:attribute name=“grammar” type=“proofType” use=“optional”>

    
    
        <xsd:annotation>
        
            <xsd:documentation>The state of the grammar checker in this document.</xsd:documentation>
        
        
        </xsd:annotation>
    
    


</xsd:attribute>
</xsd:complexType>
<xsd:simpleType name=“proofType”>
<xsd:annotation>

    
    
        <xsd:documentation>Proofing Tools state values.</xsd:documentation>
    
    


</xsd:annotation>
<xsd:restriction base=“xsd:string”>

    
    
        <xsd:enumeration value=“clean”>
        
            <xsd:annotation>
            
                <xsd:documentation>The proofing tool finished checking this document. Errors are marked and only the errors will be rechecked on open.</xsd:documentation>
            
            
            </xsd:annotation>
        
        
        </xsd:enumeration>
        <xsd:enumeration value=“dirty”>
        
            <xsd:annotation>
            
                <xsd:documentation>The proofing tool did not finish checking this document. The entire document will be rechecked on open.</xsd:documentation>
            
            
            </xsd:annotation>
        
        
        </xsd:enumeration>
    
    


</xsd:restriction>
</xsd:simpleType>
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. A computer-readable storage medium, comprising:
a first component for interpreting a word-processor document stored as an XML file; and
a second component that is configured to perform actions, including:
placing a first XML element that includes an opening tag and an ending tag that is placed before the beginning of an XML element that contains a spelling error and placing a second XML element that includes an opening tag and an ending tag that is placed after the XML element that contains the spelling error; wherein the first XML element includes an identifier indicating that it represents the beginning of the spelling error and wherein the second XML element includes an identifier indicating that it represents the end of the spelling error; wherein the first XML element and the second XML element do not include child elements and do not include content; wherein placement of the first XML element and the second XML element within the XML file do not affect the well formedness of the XML file; and
placing a third XML element that includes an opening tag and an ending tag that is placed before the beginning of one or more XML elements that contain a grammar error and placing a fourth XML element that includes an opening tag and an ending tag that is placed after the one or more XML elements that contain the grammar error; wherein the third XML element includes an identifier indicating that it represents the beginning of the grammar error and wherein the fourth XML element includes an identifier indicating that it represents the end of the grammar error; wherein the third XML element and the fourth XML element do not include child elements and do not include content; wherein placement of the third XML element and the fourth XML element within the XML file do not affect the well formedness of the XML file.

2. The computer-readable storage medium of claim 1, further comprising a third component for placing a proof state within the word-processor document; wherein placing the proof state comprises placing a placing an XML proof state element within the word-processor document that includes an opening tag and an ending tag; wherein the proof state element includes a spelling attribute and a grammar attribute.

3. The computer-readable storage medium of claim 2, wherein the first XML element, the second XML element, the third XML element, and the fourth XML element are the same type of XML element.

4. The computer-readable storage medium of claim 3, wherein the first XML element, the second XML element, the third XML element, and the fourth XML element include an enumeration value that is selected from a spell start enumeration value, a spell end enumeration value; a grammar start enumeration value and a grammar end enumeration value.

5. The computer-readable storage medium of claim 2, wherein the third component for placing the XML proof state element within the word-processor document, further comprises indicating when the word-processor document is in a clean state through an enumeration value that is associated with the XML proof state element.

6. The computer-readable storage medium of claim 5, wherein the third component for placing the XML proof state element within the word-processor document, further comprises placing a spelling proof state property.

7. The computer-readable storage medium of claim 6, wherein the third component for placing the XML proof state element within the word-processor document, further comprises placing a grammar proof state property.

8. A method for indicating errors within a word-processor document, comprising:
at a computing device, interpreting a word-processor document stored as an XML file;
at a computing device, placing a first XML element that includes an opening tag and an ending tag before the beginning of an XML element that contains an error that is selected from a grammar error and a spelling error; wherein the first XML element includes an identifier indicating that it represents the beginning of the error; wherein the first XML element does not include child elements and does not include content;
at a computing device, placing a second XML element that includes an opening tag and an ending tag after the XML element that contains the error; wherein the second XML element includes an identifier indicating that it represents the end of the error; wherein the second XML element does not include child elements and does not include content; wherein placing the first XML element and the second XML element do not affect the well formedness of the XML file.

9. The method of claim 8, further comprising placing an XML proof state element within the word-processor document.

10. The method of claim 9, wherein the first XML element and the second XML element are the same type of XML element.

11. The method of claim 9, wherein the first XML element and the second XML element include an enumeration value that is selected from a spell start enumeration value, a spell end enumeration value; a grammar start enumeration value and a grammar end enumeration value.

12. The method of claim 9, wherein placing the XML proof state element within the word-processor document, further comprises indicating when the word-processor document is in a clean state and a dirty state.

13. The method of claim 12, wherein placing the XML proof state element within the word-processor document, further comprises placing a spelling proof state property.

14. The method of claim 13, wherein placing the XML proof state element within the word-processor document, further comprises placing a grammar proof state property.

15. A system for indicating errors within a word-processor document, comprising:
a processor; and a memory, the memory being allocated for a plurality of computer-executable instructions which are loaded into the memory for execution by the processor, the computer-executable instructions performing steps comprising: a markup language file output by a word processor that includes a first XML element that includes an opening tag and an ending tag that is placed before the beginning of an XML element that contains an error that is one of a grammar error and a spelling error; wherein the first XML element includes an identifier indicating that it represents the beginning of the error; wherein the first XML element does not include child elements and does not include content; a second XML element that includes an opening tag and an ending tag after the XML element that contains the error; wherein the second XML element includes an identifier indicating that it represents the end of the error; wherein the second XML element does not include child elements and does not include content;
and
a validation engine configured to validate the markup language file; and
an application configured to read a markup language file created in accordance with a schema.

16. The system of claim 15, wherein the first XML element and the second XML element are the same type of XML element.

17. The system of claim 16, wherein the markup language file further comprises an XML proof state element.

18. The system of claim 17, wherein the XML proof state element, further comprises a clean state attribute and a dirty state attribute.

19. The system of claim 18, wherein the XML proof state element further comprises a spelling proof state property and a grammar proof state property.

20. The system of claim 16, wherein the first XML element and the second XML element include an enumeration value that is selected from a spell start enumeration value, a spell end enumeration value; a grammar start enumeration value and a grammar end enumeration value.

21. The system of claim 16, wherein an XML proof state element indicates that the document has been fully checked for at least one of spelling errors and grammar errors.