<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JCC</journal-id><journal-title-group><journal-title>Journal of Computer and Communications</journal-title></journal-title-group><issn pub-type="epub">2327-5219</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jcc.2017.514001</article-id><article-id pub-id-type="publisher-id">JCC-80990</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Mathematical Expression Extraction in Text Fields of Documents Based on HMM
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Xuedong</surname><given-names>Tian</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Ruihan</surname><given-names>Bai</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Fang</surname><given-names>Yang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Jinyuan</surname><given-names>Bai</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Xinfu</surname><given-names>Li</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>School of Cyber Security and Computer, Hebei University, Baoding, China</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>laurabrh@126.com(RB)</email>;</corresp></author-notes><pub-date pub-type="epub"><day>12</day><month>12</month><year>2017</year></pub-date><volume>05</volume><issue>14</issue><fpage>1</fpage><lpage>13</lpage><history><date date-type="received"><day>7,</day>	<month>November</month>	<year>2017</year></date><date date-type="rev-recd"><day>9,</day>	<month>December</month>	<year>2017</year>	</date><date date-type="accepted"><day>12,</day>	<month>December</month>	<year>2017</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  Aiming at the problem that the mathematical expressions in unstructured text fields of documents are hard to be extracted automatically, rapidly and effectively, a method based on Hidden Markov Model (HMM) is proposed. Firstly, this method trained the HMM model through employing the symbol combination features of mathematical expressions. Then, some preprocessing works such as removing labels and filtering words were carried out. Finally, the preprocessed text was converted into an observation sequence as the input of the HMM model to determine which is the mathematical expression and extracts it. The experimental results show that the proposed method can effectively extract the mathematical expressions from the text fields of documents, and also has the relatively high accuracy rate and recall rate.
 
</p></abstract><kwd-group><kwd>Mathematical Expression Extraction</kwd><kwd> Hidden Markov Model</kwd><kwd> Text Fields</kwd><kwd> Documents</kwd><kwd> Symbol Combination Features</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Extracting the information we need from the text in documents and converting them into structured data for storing in database is the premise of their further utilization [<xref ref-type="bibr" rid="scirp.80990-ref1">1</xref>] . At present, there are mainly three kinds of text information extraction technology: dictionary based model [<xref ref-type="bibr" rid="scirp.80990-ref2">2</xref>] , rule based model [<xref ref-type="bibr" rid="scirp.80990-ref3">3</xref>] and statistics based model [<xref ref-type="bibr" rid="scirp.80990-ref4">4</xref>] .</p><p>Hidden Markov Model [<xref ref-type="bibr" rid="scirp.80990-ref5">5</xref>] is one of the statistical models which obtains its model parameters through training instead of prior structural dictionaries and rules. It is established easily with stronger applicability and higher accuracy rate and recall rate. Therefore, it has got more attention of researchers, and widely been used in word segmentation [<xref ref-type="bibr" rid="scirp.80990-ref6">6</xref>] , speech recognition [<xref ref-type="bibr" rid="scirp.80990-ref7">7</xref>] , information extraction [<xref ref-type="bibr" rid="scirp.80990-ref8">8</xref>] and other fields.</p><p>Yu et al. [<xref ref-type="bibr" rid="scirp.80990-ref9">9</xref>] proposed an algorithm based on Hidden Markov Model for extracting the information of the header and reference of scientific papers in Chinese. At first, the algorithm segmented the paper header into semantic blocks by utilizing semicolon, enter, comma and other punctuation marks, and then extracted information from the semantic blocks. In order to make HMM more practical, the algorithm used the method of vertical merger and horizontal merger to combine HMM states when the model structure was being trained. In this way, an optimized HMM was obtained which had effectively improved the extraction accuracy rate and recall rate.</p><p>Liu [<xref ref-type="bibr" rid="scirp.80990-ref10">10</xref>] proposed an extraction method that can extract text information from different fields and data sets based on HMM. Firstly, the initial probability and transition probability parameters were divided into several templates for training. Based on this, a text information extraction algorithm based on multi-template HMM was proposed. It can effectively solve the problem that the training data was diversified and the model parameters were hard to learn, and has higher accuracy rate and recall rate. In addition, a new algorithm of text information extraction based on maximum entropy HMM was proposed through combining rule based method and statistic based method according to the information of context features and words meaning, which obtained a better extraction result.</p><p>Liu [<xref ref-type="bibr" rid="scirp.80990-ref11">11</xref>] proposed an information extraction method based on maximum entropy HMM (ME-HMM) and ontology technology for accurately extracting useful information from comprehensive evaluation of books. ME-HMM was used to some pre-processing works, such as nominal marking and named entity recognition. The information extraction model based on ontology technology was used for the extraction of professional sentence and addresses to solve the problems of information association and unclear underlying meaning. The experimental results show that this method can improve the accuracy rate of information extraction.</p><p>Du et al. [<xref ref-type="bibr" rid="scirp.80990-ref12">12</xref>] put forward a method of text information extraction based on mixed HMM to get the place names from the metadata of documents. This method considered the dependence of transition probability at a moment on previous and latter states. Two pass decoding of positive sequence and negative sequence were performed by utilizing Viterbi algorithm as decoding. The experimental results show that the method can achieve a better information extraction result.</p><p>Shuang and Sun [<xref ref-type="bibr" rid="scirp.80990-ref13">13</xref>] proposed an improved information extraction method based on HMM. The transition probability and output probability of the improved model were not only dependent on the current state, but also can be corrected according to the forward and backward dependency which can further improve the information extraction quality. The experimental results show that the proposed method can further improve the extraction quality.</p><p>In a word, the HMM has been widely used in text information extraction and played a tremendous role. However, there are less researches employing HMM on the mathematical expression extraction from text fields.</p><p>Because of the complex syntax rules of the mathematical expressions, if we use the rule based method of text field extraction to extract mathematical expressions, complicated rules should be made and the applicability of this method is limited. Based on the above considerations, this paper proposes a method to extract mathematical expressions from the unstructured text fields of documents based on HMM which could effectively avoid these problems. Firstly, the HMM model is constructed according to the symbol combination feature of the mathematical expression. Then, the extracted text is pre-processed. Finally, the trained model is used to extract the mathematical expressions automatically. Simulation results show that this method can automatically, rapidly and effectively extract mathematical expressions from the text fields.</p></sec><sec id="s2"><title>2. The Description of the Problem</title><p>It is found that the structured web pages express formulae through description language such as LaTeX [<xref ref-type="bibr" rid="scirp.80990-ref14">14</xref>] , MathML [<xref ref-type="bibr" rid="scirp.80990-ref15">15</xref>] , OpenMath [<xref ref-type="bibr" rid="scirp.80990-ref16">16</xref>] and so on which generally have fixed embedding modes and separating labels. For example, in LaTeX documents, the embedded formulae are labeled as “$…$”, “\[…\]”, “\begin{math}…\end{math}”. While the isolated formulae are labeled as “$$…$$”, “\[…\]”, “\begin{align}…\end{align}”, etc. Therefore, the mathematical expressions in the structured documents can be extracted according to the labels. Cui et al. [<xref ref-type="bibr" rid="scirp.80990-ref17">17</xref>] summarized the characteristics of various kinds of formats of formulae exist on web pages. And put forward a method of mathematical formula extraction based on heuristic rules. Chen et al. [<xref ref-type="bibr" rid="scirp.80990-ref18">18</xref>] proposed a method to automatically analyze and extract the features of LaTeX expressions and filtering formulae according to their features. In this method, the extraction accuracy was improved efficiently.</p><p>Different from structured text like web pages, the mathematical expressions existing in unstructured text have no clear labels. We cannot extract mathematical expressions from these kinds of documents directly with labels. The content of text consists of characters, numbers, punctuations and other printable symbols. And the combination modes of these symbols are many and varied. There are also no observable rules to separate mathematical expressions from ordinary text. In addition, the sources of text are varied, the typesetting forms and expression styles of text are also different, and the content of text is very large sometime. All of these reasons make great challenges and difficulties to extract mathematical expressions from ordinary text. So it is necessary to research the method for extracting mathematical expressions from ordinary text without special labels.</p></sec><sec id="s3"><title>3. Algorithm for Extracting Mathematical Expressions in Text Field of Documents Based on HMM</title><sec id="s3_1"><title>3.1. The Overall Framework of the Algorithm</title><p>According to the characteristics of mathematical expressions in the text fields of documents, this paper proposes an automatic extraction algorithm of the mathematical expressions based on HMM. The overall framework is shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>.</p><p>The process of extracting mathematical expressions in text fields of documents based on HMM can be divided into two parts described as follows:</p><p>1) Training model</p><p>Input: Training samples (the mathematical expressions).</p><p>Output: HMM model.</p><p>Step 1: Get the training samples, that is, the correct mathematical expressions.</p><p>Step 2: Set up the HMM status value and observation value for expressions.</p><p>Step 3: Use Baum-Welch algorithm [<xref ref-type="bibr" rid="scirp.80990-ref19">19</xref>] to learn the parameters for training data and set up the model.</p><p>Step 4: When the training generation number meets the preset value, stop training; otherwise, go to Step 3.</p><p>2) Testing model</p><p>Input: Trained HMM model and test samples (the text which contains mathematical expressions to be extracted).</p><p>Output: Mathematical expressions.</p><p>Step 1: Obtain the text that needs to be processed.</p><p>Step 2: Text pre-processing.</p><p>Step 3: Extract mathematical expressions.</p></sec><sec id="s3_2"><title>3.2. Construction of HMM Model and Its Parameter Learning</title><p>Some symbols of the mathematical expressions in text represented in Unicode codes are shown in <xref ref-type="table" rid="table1">Table 1</xref>.</p><p>Hidden Markov Model (HMM) [<xref ref-type="bibr" rid="scirp.80990-ref20">20</xref>] is the model of a double random process based on statistics. To construct the HMM model, we should first determine the structure of the model, that is, the number of contained states and the conversion between each state. According to the <xref ref-type="table" rid="table1">Table 1</xref>, we define a total of eight states of HMM as: the variables (numbers, letters, Greek letters), monocular operation (the operator has one operand only), binocular vision (the operator has two operations), punctuation, left and right delimitations, delimiter in a set, superscripts and subscripts, denoted as S = { E , U − O , B − O , P , G 1 , G 2 , B − D , C , Q } . The observed values of the HMM model are the mathematical symbols shown in the mathematical expressions. This paper defines that the observation values corresponding to each state which are shown in <xref ref-type="table" rid="table2">Table 2</xref>.</p><p>In addition to the above observations, we define the trigger word dictionary as follows:</p><p>Definition 1: Trigger_W, the trigger word, is an important part of a specific event that can describe its special attribute information.</p><p>In mathematical expression extraction, Trigger_W = {sin, cos, Tan, cot, sec, csc, arcsin, arccos, arctan, arccot, arcsec, arccsc}. Trigger_W is employed as the</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Special symbols of mathematical expressions</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Symbolic</th><th align="center" valign="middle" >Meaning</th><th align="center" valign="middle" >Symbolic</th><th align="center" valign="middle" >Meaning</th></tr></thead><tr><td align="center" valign="middle" >+, −, *, /, &#215;, &#247;</td><td align="center" valign="middle" >Four arithmetic symbols</td><td align="center" valign="middle" >(), [<xref ref-type="bibr" rid="scirp.80990-ref"></xref>], {}</td><td align="center" valign="middle" >Bracket</td></tr><tr><td align="center" valign="middle" >=, ≠, ≤, ≥, ≈, &lt;, &gt;</td><td align="center" valign="middle" >Equivalent relational symbols</td><td align="center" valign="middle" >∫, ∮  </td><td align="center" valign="middle" >Integral symbol</td></tr><tr><td align="center" valign="middle" >∩ , ∪</td><td align="center" valign="middle" >Set symbols</td><td align="center" valign="middle" >||</td><td align="center" valign="middle" >Absolute value sign</td></tr><tr><td align="center" valign="middle" >%</td><td align="center" valign="middle" >Percent symbol</td><td align="center" valign="middle" >!</td><td align="center" valign="middle" >Factorial symbol</td></tr><tr><td align="center" valign="middle" >Σ, Π</td><td align="center" valign="middle" >Summation symbol and quadrature symbol</td><td align="center" valign="middle" >^, _</td><td align="center" valign="middle" >Square, Subscript</td></tr><tr><td align="center" valign="middle" >:</td><td align="center" valign="middle" >Division symbol</td><td align="center" valign="middle" >∃</td><td align="center" valign="middle" >Existential symbol</td></tr><tr><td align="center" valign="middle" >√</td><td align="center" valign="middle" >Radical sign</td><td align="center" valign="middle" >&amp;</td><td align="center" valign="middle" >And</td></tr></tbody></table></table-wrap><table-wrap id="table2" ><label><xref ref-type="table" rid="table2">Table 2</xref></label><caption><title> Observation values corresponding to each state</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >State</th><th align="center" valign="middle" >Observation values</th></tr></thead><tr><td align="center" valign="middle" >E</td><td align="center" valign="middle" >Numbers, a-z, A-Z, Greek letters, begin with digitals and end with letters, begin and end with letters</td></tr><tr><td align="center" valign="middle" >U − O</td><td align="center" valign="middle" >+, −, !, %, &amp;</td></tr><tr><td align="center" valign="middle" >B − O</td><td align="center" valign="middle" >+, −, =, /, :, *, &lt;, &gt;</td></tr><tr><td align="center" valign="middle" >P</td><td align="center" valign="middle" >!, :, ;</td></tr><tr><td align="center" valign="middle" >G 1</td><td align="center" valign="middle" >{, [, (, |</td></tr><tr><td align="center" valign="middle" >G 2</td><td align="center" valign="middle" >}, ], ), |</td></tr><tr><td align="center" valign="middle" >B − D</td><td align="center" valign="middle" >, , ;</td></tr><tr><td align="center" valign="middle" >Q</td><td align="center" valign="middle" >^, _</td></tr></tbody></table></table-wrap><p>prior knowledge in knowledge base for trigonometric function, inverse trigonometric function extraction.</p><p>Taking the formula “ a !   + 4 b &#215; ( c &#247; 5 ) = − d ” as an example, the corresponding state value and the observed value are shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>.</p><p>When the HMM model is constructed, it is assumed that there are a meaningless start state (start) and a meaningless end state (end) as the preparatory state and final state of the model. Taking the mathematical expressions “ a !   + 4 b &#215; c = − d ”, “ ( a − b ) &#247; 5 d = − c ”, “ 3 a + 4 b &lt; ( − a b ) &#215; c ” as an example, it’s HMM model structure is shown in <xref ref-type="fig" rid="fig3">Figure 3</xref>.</p><p>After determining the model structure, we need to find the transition probability of state and the output probability of observation. In this experiment, the Baum-Welch algorithm was used to calculate the model parameters, and the specific steps are as follows:</p><p>Step 1: Define two intermediate variables: ξ t ( i , j ) and γ t ( i ) . Where ξ t ( i , j ) is the probability of the state i and the state j corresponding to the model λ = { A , B , Π } and the observed sequence O = { o 1 , o 2 , ⋯ , o T } at the moment t and the moment t + 1 . γ t ( i ) is the state probability at the moment t of the</p><p>corresponding state i in the case of given model and observation sequence [<xref ref-type="bibr" rid="scirp.80990-ref13">13</xref>] :</p><p>ξ t ( i , j ) = α t ( i ) a i j b j ( O t + 1 ) β t + 1 ( j ) ∑ i = 1 N ∑ j = 1 N α t ( i ) a i j b j ( O t + 1 ) β t + 1 ( j ) (1)</p><p>γ t ( i ) = ∑ j = 1 N ξ t ( i , j ) = α t ( i ) β t ( i ) P ( o | λ ) = α t ( i ) β t ( i ) ∑ i = 1 N α t ( i ) β t ( i ) (2)</p><p>Step 2: Initialize [<xref ref-type="bibr" rid="scirp.80990-ref10">10</xref>] : π &#175; i = γ 1 ( i ) , the expected value of the state S i at time t = 1 is λ = { A 0 , B 0 , π } .</p><p>Step 3: Iterative compute: Let λ 0 = λ</p><p>π &#175; i = γ 1 ( i ) ,   1 ≤ i ≤ N (3)</p><p>a &#175; i j = ∑ t = 1 T − 1 ξ t ( i , j ) ∑ t = 1 T − 1 γ t ( i ) (4)</p><p>b &#175; j ( k ) = ∑ t = 1 T γ t ( j ) &#215; δ ( o t , v k ) ∑ t = 1 T γ t ( j ) (5)</p><p>where,</p><p>{ δ ( o t , v k ) = 1 , o t = v k δ ( o t , v k ) = 0 , o t ≠ v k (6)</p><p>Step 4: The initial value is substituted into the above equations, and the new parameters are calculated. The iteration is repeated until the parameter converges, the method of judging convergence is:</p><p>| log ( P ( o | λ i + 1 ) ) − log ( P ( o | λ i ) ) | &lt; ε (7)</p><p>where the threshold ε is generally set to 1 e − 6 .</p></sec><sec id="s3_3"><title>3.3. Extraction of Mathematical Expressions</title><p>Extracting mathematical expressions from text fields of documents can be implemented with the following steps:</p><p>Step 1: Design a crawler, and the depth of crawler is 20; select website home pages which are relevant to mathematics as the crawler entrance; start the crawler, and save the acquired pages to a local file.</p><p>Step 2: For the web pages crawled from the Internet, block the web pages at first [<xref ref-type="bibr" rid="scirp.80990-ref21">21</xref>] . Remain the main part and delete the navigation blocks and link blocks. As there are a lot of HTML labels in web pages, the blocked text will be cleaned through removing the useless noise data in order to reduce the noise in samples and improve the accuracy rate of mathematical expression extraction, which is shown in <xref ref-type="table" rid="table3">Table 3</xref>.</p><table-wrap id="table3" ><label><xref ref-type="table" rid="table3">Table 3</xref></label><caption><title> Noise types and processing methods</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Noise types</th><th align="center" valign="middle" >Processing methods</th></tr></thead><tr><td align="center" valign="middle" ><sup></sup>; <sub></sub></td><td align="center" valign="middle" >replaced with “^”; “_”</td></tr><tr><td align="center" valign="middle" >mathematical expressions with label</td><td align="center" valign="middle" >regular matching filtering</td></tr><tr><td align="center" valign="middle" >label</td><td align="center" valign="middle" >regular matching filtering: &lt;.*?&gt;</td></tr><tr><td align="center" valign="middle" >&amp;nbsp; &amp;amp; &amp;gt; &amp;lt</td><td align="center" valign="middle" >replaced with “blank”; “&amp;”; “&gt;”; “&lt;”</td></tr></tbody></table></table-wrap><p>Step 3: Segment the text which have been removed the useless noise data. After segmentation, use the word library of WordNet [<xref ref-type="bibr" rid="scirp.80990-ref22">22</xref>] (containing about 350 thousand words) to filter the text. As shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>, the filtered text will be taken as the input of HMM model.</p><p>Step 4: Use the HMM model which has been constructed and the Viterbi algorithm to determine whether the expression in text is a mathematical expression or not, if so, the expression will be extracted.</p><p>For example, the proposed method analyzes the sentence “There’s good reason why mathematics formulas are not patentable! It’s really easy {4 ghs/} to come up with new formulas. Like a + b = c + d . I bet you won’t find that in any textbook, because 56 + 4 = 60 it’s not something really important.” through the following steps:</p><p>Step 1: Initialize: Build training samples and test samples.</p><p>Step 2: Train HMM model by training samples.</p><p>Step 3: Confirm the model structure, and evaluate parameters by Baum-Welch algorithm.</p><p>Step 4: Do some pre-processing works for the text.</p><p>String content = mwContent,html().replaceAll(“noise”, “replace word”)</p><p>//remove the useless noise from the text</p><p>String [<xref ref-type="bibr" rid="scirp.80990-ref"></xref>] tempArr = sb.toString ().replaceAll (“[ ]{2,}”, “ ”).replaceAll (“\\[[0-9a-zA-Z]{1,}]\\”, “ ”).split(“ ”);</p><p>//cut the text according to the blank</p><p>For each vocabulary in tempArr {</p><p>If (wordSet contains vocabulary) {continue}</p><p>else {save vocabulary until the next math}</p><p>}</p><p>//Use the WordNet word library to filter the text, and then save the filtered text in fmList.</p><p>Step 5: Take the fmList as the input for HMM model.</p><p>Step 6: Use the Viterbi algorithm to determine whether the expression is a mathematical expression.</p><p>Step 7: If so, the expressions will be extracted.</p></sec></sec><sec id="s4"><title>4. Experiment Results and Analysis</title><p>In order to prove the availability of proposed method based on HMM model in</p><p>this paper, the simulation experiment is carried out according to the above steps with the development environment of the open source Jahmm-0.6.1 framework and MyEclipse software.</p><p>The training samples in this simulation experiment are 13,423 mathematical expressions from mathematical textbooks of elementary school. The testing samples are 2100 web pages from the Internet. Each web page is taken as a sample. According to the construction rule of HMM model described above, the new model parameters can be obtained as λ = { A , B , Π } . Part of the observation probability distribution matrix after training is shown in <xref ref-type="fig" rid="fig5">Figure 5</xref>.</p><p>The experimental results will be evaluated by two evaluation indexes: accuracy rate and recall rate. The calculation methods of two evaluation indexes are expressed as follows:</p><p>Accuracyrate = N extracted / N marked (8)</p><p>Re call           rate = N extracted / N all (9)</p><p>where N extracted is the number of the mathematical expressions extracted correctly; N marked is the number of the marked mathematical expressions in the text; N all is the number of all mathematical expressions in the text.</p><p>As shown in <xref ref-type="table" rid="table4">Table 4</xref>, the accuracy rate and recall rate of the proposed algorithm have some slight oscillations in the extraction process, but the whole situation tends to be stable. With the increase of text number, the accuracy rate and recall rate will also increase and tend to be stable finally, but they may decrease when the text number is too large. Because of the limited training samples and various mathematical expressions, it is very difficult to describe all cases by only a model, so the extraction model should be expanded further.</p><p>Besides, by experimental analysis, the influence factors are those texts which are similar to mathematical expressions, such as time symbol (2007-03-02), name symbol (Jason-Leon), number symbol (N68-32), unregistered words symbol (e.g. e-mail), etc.</p><p>For verifying the performance of our method, we built a simulation system which employed the algorithm proposed in Reference [<xref ref-type="bibr" rid="scirp.80990-ref18">18</xref>] . It is worth nothing that due to the differences of experimental environment, experimental data such as the mathematical expression format, and the limitations of our comprehensions on the original paper, the comparison results could not completely meet the results of the original paper and could only roughly reflect the situations of the method.</p><p>The comparison results about accuracy rate and recall rate are shown in <xref ref-type="fig" rid="fig6">Figure 6</xref>.</p><table-wrap id="table4" ><label><xref ref-type="table" rid="table4">Table 4</xref></label><caption><title> Extraction results of mathematical expressions</title></caption><table><tbody><thead><tr><th align="center" valign="middle"  colspan="2"  >Methods</th><th align="center" valign="middle" >300</th><th align="center" valign="middle" >600</th><th align="center" valign="middle" >900</th><th align="center" valign="middle" >1200</th><th align="center" valign="middle" >1500</th><th align="center" valign="middle" >1800</th></tr></thead><tr><td align="center" valign="middle"  rowspan="4"  >Proposed method Simulation system</td><td align="center" valign="middle" >Recall rate</td><td align="center" valign="middle" >0.6753</td><td align="center" valign="middle" >0.7264</td><td align="center" valign="middle" >0.7415</td><td align="center" valign="middle" >0.7709</td><td align="center" valign="middle" >0.7410</td><td align="center" valign="middle" >0.7354</td></tr><tr><td align="center" valign="middle" >Accuracy rate</td><td align="center" valign="middle" >0.7167</td><td align="center" valign="middle" >0.7650</td><td align="center" valign="middle" >0.8557</td><td align="center" valign="middle" >0.8986</td><td align="center" valign="middle" >0.8741</td><td align="center" valign="middle" >0.8325</td></tr><tr><td align="center" valign="middle" >Recall rate</td><td align="center" valign="middle" >0.6549</td><td align="center" valign="middle" >0.7344</td><td align="center" valign="middle" >0.7011</td><td align="center" valign="middle" >0.7282</td><td align="center" valign="middle" >0.7310</td><td align="center" valign="middle" >0.7013</td></tr><tr><td align="center" valign="middle" >Accuracy rate</td><td align="center" valign="middle" >0.7328</td><td align="center" valign="middle" >0.7862</td><td align="center" valign="middle" >0.8157</td><td align="center" valign="middle" >0.8278</td><td align="center" valign="middle" >0.8523</td><td align="center" valign="middle" >0.7893</td></tr></tbody></table></table-wrap><p>It can be seen from <xref ref-type="fig" rid="fig6">Figure 6</xref> that the proposed method has better recall rate and accuracy rate. Moreover, with the increase of text number, the advantage of the proposed method is more obvious. The reason is that the rule based method need to locate the symbols of mathematical expressions and scan back and forth to extract mathematical expressions. When it identifies the scope of texts, the error of taking ordinary text as mathematical expressions would easily occur. In addition, with the increase of the number of mathematical expressions, the rule based method need to develop a large number of combination rules. Once the combination rules are incomplete, the recall rate will be affected, while the proposed method could effectively avoid the problems.</p><p>For verifying the time efficiency of proposed method, different numbers of mathematical expressions were selected to test the extraction time. The test data is shown in <xref ref-type="fig" rid="fig7">Figure 7</xref>.</p><p>From <xref ref-type="fig" rid="fig7">Figure 7</xref>, we can see that the average extraction time is 0.0011 ms when the number of mathematical expressions in text equals 5 and 0.0053 ms when the number of mathematical expressions in text equals 45 respectively. While the average extraction time of the simulation system is longer than the proposed method. The reason is that the compared method need to locate the mathematical expressions and scan back and forth firstly, and carry out many filtering operations before extraction. The proposed method can avoid these processes and improve the extraction efficiency obviously. These two curves have some overlapping data at the first phase. The reason is that when the number of mathematical expressions is relatively great, the advantage of proposed method is obvious, and the extraction time is less than simulation system. In contrast, the extraction time is about the same when the number of mathematical expressions is small.</p></sec><sec id="s5"><title>5. Conclusion</title><p>To solve the problem that the mathematical expressions in unstructured text fields of documents is hard to be extracted automatically, rapidly and effectively, a novel method based on HMM was proposed. Through considering the characteristics of mathematical expressions, this method can realize the extraction of the mathematical expressions in text fields of documents with relative high accuracy rate and recall rate. However, there are some shortcomings of the</p><p>mathematical expression extraction method based on HMM. Firstly, this method needs plenty of training samples and takes a lot of training time. Secondly, if the states of HMM is not comprehensive enough, the extracted result will be not good. We shall further improve the observed values and state values of HMM model and optimize the model parameters to make the model be more suitable for more mathematical expressions and achieve better extraction results.</p></sec><sec id="s6"><title>Acknowledgements</title><p>This work is supported by the National Natural Science Foundation of China (Grant No. 61375075). The Key Project of the Science and Technology Research Program in University of Hebei Province of China (Grant No. ZD2017208; ZD2017209).</p></sec><sec id="s7"><title>Cite this paper</title><p>Tian, X.D., Bai, R.H., Yang, F., Bai, J.Y. and Li, X.F. (2017) Mathematical Expression Extraction in Text Fields of Documents Based on HMM. Journal of Computer and Communications, 5, 1-13. https://doi.org/10.4236/jcc.2017.514001</p></sec></body><back><ref-list><title>References</title><ref id="scirp.80990-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Guo, X.Y. and He, T.T. (2015) Survey about Research on Information Extraction. Computer Science, 42, 14-17.</mixed-citation></ref><ref id="scirp.80990-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Zhu, H.H. and Yu, Q.S. (2014) Study on the Extraction of Chinese Microblog Subjective Sentences Based on Lexicon and Corpus. Journal of East China Normal University (Natural Science), No. 4, 62-68.</mixed-citation></ref><ref id="scirp.80990-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Yu, C., Mao, Z. and Gao, S. (2017) An Approach of Extracting Information for Maritime Unstructured Text Based on Rules. Traffic information and safety, 35, 40-47.</mixed-citation></ref><ref id="scirp.80990-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Li, Q. and Chen, Y.P. (2010) Personalized Text Snippet Extraction Using Statistical Language Models. Pattern Recognition, 43, 378-386.https://doi.org/10.1016/j.patcog.2009.06.003</mixed-citation></ref><ref id="scirp.80990-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Zhou, C. and Li, S. (2011) Research of Information Extraction Algorithm based on Hidden Markov Model. 2010 2nd International Conference on Information Science and Engineering (ICISE), Hangzhou, 4-6 December 2010, 1-4.</mixed-citation></ref><ref id="scirp.80990-ref6"><label>6</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Wang</surname><given-names> Q.F. </given-names></name>,<etal>et al</etal>. (<year>2016</year>)<article-title>Research on Chinese Word Segmentation Based on Hidden Markov Model</article-title><source> Wireless Internet Technology</source><volume> 13</volume>,<fpage> 106</fpage>-<lpage>107</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.80990-ref7"><label>7</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Yuan</surname><given-names> L.C. </given-names></name>,<etal>et al</etal>. (<year>2008</year>)<article-title>A Speech Recognition Method Based on Improved Hidden Markov Model</article-title><source> Journal of Central South University (Science and Technology)</source><volume> 39</volume>,<fpage> 1303</fpage>-<lpage>1308</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.80990-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Zhu, W.H., Lu, Y. and Liu, B.B. (2010) Improvement of Web Information Extraction Algorithm Based on HMM. Computer Science, 37, 203-206.</mixed-citation></ref><ref id="scirp.80990-ref9"><label>9</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Yu</surname><given-names> J.D.</given-names></name>,<name name-style="western"><surname> Fan</surname><given-names> X.Z. and Yin</given-names></name>,<name name-style="western"><surname> J.H.</surname><given-names> et al. </given-names></name>,<etal>et al</etal>. (<year>2007</year>)<article-title>Information Extraction from Chinese Research Papers Based on Hidden Markov Model</article-title><source> Computer Engineering</source><volume> 33</volume>,<fpage> 190</fpage>-<lpage>192</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.80990-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Liu, Y.Z. (2003) Algorithm Research for Text Information Extraction Based on Hidden Markov Model. Master’s Thesis, Hunan University, Changsha.</mixed-citation></ref><ref id="scirp.80990-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Liu, Z. (2016) Research on the Text Information Extraction of Author Relevant Information. Master’s Thesis, Northeast Normal University, Nanjing.</mixed-citation></ref><ref id="scirp.80990-ref12"><label>12</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Du</surname><given-names> Q.X.</given-names></name>,<name name-style="western"><surname> Wang</surname><given-names> H.G. and Shao</given-names></name>,<name name-style="western"><surname> Z.Z.</surname><given-names> et al. </given-names></name>,<etal>et al</etal>. (<year>2017</year>)<article-title>Place Name Extraction Method of Literature Metadata Based on the Hybrid HMM</article-title><source> Computer &amp; Digital Engineering</source><volume> 45</volume>,<fpage> 101</fpage>-<lpage>106</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.80990-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Shuang, Z. and Sun, L. (2017) Research and Application for Web Information Extraction Based on Improved Hidden Markov Model. Computer Applications and Software, 34, 42-47.</mixed-citation></ref><ref id="scirp.80990-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Gurari, E.M (2004) TEX4ht: HTML Production http://www.tug.org/TUGboat/tb25-1/gurari.pdf</mixed-citation></ref><ref id="scirp.80990-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Wang, Q. and Liang, J. (2004) Mathematical Markup Language. Modern Educational Technology, 14, 63-66.</mixed-citation></ref><ref id="scirp.80990-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Strotmann, A. and Kohout, L. (2000) Openmath. ACM SIGSAM Bulletin, 34, 66-72. https://doi.org/10.1145/362001.362024</mixed-citation></ref><ref id="scirp.80990-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Cui, L.W., Su, W., Guo, W., et al. (2011) Extraction of Web Mathematical Formulas Based on Nutch. Journal of Guangxi Normal University: Natural Science Edition, 29, 167-172.</mixed-citation></ref><ref id="scirp.80990-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Chen, L.H., Su, W., Cai, C., et al. (2014) Research of Extraction Method of Web Mathematical Formula Based on LaTex. Computer Science, 41, 148-154.</mixed-citation></ref><ref id="scirp.80990-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Liu, B.B. (2008) Research and Improvement of Web Information Extraction Method Based on HMM Model. Chongqing University, Chongqing.</mixed-citation></ref><ref id="scirp.80990-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">Zhang, Y. (2014) The Algorithm Research of Chinese Information Extraction Based on the Hidden Markov Model. University of Science and Technology Liaoning, Anshan.</mixed-citation></ref><ref id="scirp.80990-ref21"><label>21</label><mixed-citation publication-type="other" xlink:type="simple">Ren, L.F. (2012) Design and Implementation of Education News Webpage Information Extraction System. South China University of Technology, Guangzhou.</mixed-citation></ref><ref id="scirp.80990-ref22"><label>22</label><mixed-citation publication-type="other" xlink:type="simple">Geum, Y. and Park, Y. (2016) How to Generate Creative Ideas for Innovation: A Hybrid Approach of WordNet and Morphological Analysis. Technological Forecasting &amp; Social Change, 111, 176-187. https://doi.org/10.1016/j.techfore.2016.06.026</mixed-citation></ref></ref-list></back></article>