• No results found

A Sentence Similarity Computation for Restricted Domain

N/A
N/A
Protected

Academic year: 2020

Share "A Sentence Similarity Computation for Restricted Domain"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

2018 International Conference on Modeling, Simulation and Optimization (MSO 2018) ISBN: 978-1-60595-542-1

A Sentence Similarity Computation for Restricted Domain

Liu-tong XU, Jun GUO

*

and Hai HUANG

Beijing University of Posts and Telecommunications, Cloud Computing and Service Computing Center, BeiJing, China

*Corresponding author

Keywords: Restricted domain, Sentence similarity computation, Vector space model, TextRank-RD.

Abstract. To improve the accuracy of sentence similarity computation in automatic question

answering system for restricted domain, this paper proposed a new TextRank-RD algorithm based on vector space model. The algorithm assigns the node an initial value based on three factors: whether the domain dictionary contains the word, whether the word is a none, the position of the word. And it uses a weighted graph model that assigns weights according to the importance of nodes rather than an unweighted graph model that assigns weights equally. The experimental results show that the algorithm improved the accuracy of sentence similarity calculation compared with the TF-IDF algorithm based on vector space model, and this has important significance to improve the efficiency of the automatic question answering system for restricted domain.

Introduction

Answering students' doubts is a very important part of the teaching process. At present, many experts in the field of Natural Language Processing are studying the system to help this link, and the intelligent question answering system is an achievement. It allows students to ask questions in natural language, and provides students with concise and accurate answers, which enriches the way teachers and students communicate. Using this system is not subject to time and space constraints, which can help improve learning efficiency. The FAQ library keeps questions and corresponding answers often asked by students. We calculate the similarity between the students' input questions and the existing questions in the FAQ library, and return the answer of the question with the highest similarity. The FAQ library eliminates the complicated process of problem understanding, information retrieval and answer extraction, and improves efficiency. It is an important part of the intelligent question answering system. The similarity calculation effect between the questions entered by the student and the questions in the FAQ library will directly affect the accuracy of the system, and improve the computational effect of sentence similarity can make the accuracy of the search greatly improved. At present, there are many researches on sentence similarity computation, and the TF-IDF algorithm based on vector space model[1] is a famous one. It uses the TF-IDF algorithm to weight the words and express the statements as vectors in the vector space model, and then transforms the similarity calculation between the text contents into the vector similarity calculation in the vector space. But the method is based on word frequency to weight the words, which is not good for short texts. While the questions in the FAQ library are mostly short text, and the effect of the question answering system for restricted domain is much better than that for open domain. Therefore, this paper proposes a method of sentence similarity computation for restricted domain, it uses the TextRank algorithm to weight the words and improves the voting formula.

Related Research

(2)

is the most classical sentence similarity algorithm, it mainly uses the word frequency to calculate the similarity, which is a statistical method. In Natural Language Processing, the vector space model is often used to measure whether two words or two sentences are similar. TF-IDF is a statistical method that is used to evaluate the importance of a word in one file set. The importance of the word is proportional to the number of times it appears in the document, but it is inversely proportional to the frequency it appears in the corpus[3]. The main idea of TF-IDF is-- If a word or phrase appears in an article at a high frequency and is rarely present in other articles, it is considered that the word or phrase has a good ability of distinction and is suitable for classification[4]. TF indicates the frequency of the word appears in a document. The main idea of IDF is that if the number of documents containing the entry t is less, that is, the smaller the n, the larger the IDF, the better the ability of t to distinguish the document.

To sum up, the more times a word appears in a document, and the less times the word appears in other documents (that is, only a few documents containing the word), indicating that the word is important for this document and has a strong classification ability.

After dividing a sentence into words, using TF-IDF to weight the words, we can turn the statement into a vector, and the statement similarity calculation can be converted into the calculation of the angle between the vectors. However, compared with the document, the length of the sentence is relatively short, the number of words is also very small, so the effect of the TF-IDF method which uses the word frequency to calculate statement similarity will be affected. Therefore, this paper considers using the TextRank algorithm to weight the words.

Both the TextRank[5] and the TF-IDF algorithm implement the keyword extraction by weighting the word, and the weight of the word indicates the importance of it to the statement. Obviously, the closer the power of the words that the two sentences contain, the greater the similarity is. Therefore, improve the accuracy of TextRank algorithm can improve the results of sentence similarity. At present, there are many researches of the TextRank algorithm. Li Guangyi and Wang Houfeng proposed a TextRank algorithm based on domain knowledge, they improved the performance of the algorithm by introducing known keywords as domain knowledge into the algorithm[6]. And Lu Wei, Cheng Qi Kai used the co-occurrence frequency between words as the weight of the side to build a weighted network to improve the accuracy of the algorithm[7].Yu Shan Sha, Su Jing Dian improved the accuracy and reduced the recall rate by introducing information such as title, paragraph, special sentence, sentence position and length into the TextRank[8].Based on the previous research, this paper proposes a TextRank-RD algorithm based on vector space model. We introduce three factors which are whether the word is in the domain dictionary, whether the word is a noun and its position into the TextRank algorithm, and improves the iterative formula to make the final result of the similarity calculation better.

Research and Design

In the TF-IDF algorithm based on the vector space model, the word is weighted by the TF-IDF algorithm when the text is transformed into the vector in the vector space model. Both TextRank algorithm and TF-IDF algorithm can be used for keyword extraction, and when dealing with short text, TxetRank algorithm is better than TF-IDF algorithm. And obviously the better the effect of keyword extraction, the better the result of the similarity degree calculation. Therefore, this paper uses the TextRank algorithm to calculate the word weight to complete the transformation of the sentence to the vector.

(3)

between the pages. So that we can create a graph model and the we can calculate the weight of the nodes according to the iterative formula.

TextRank's graph model can be expressed as G=(V,E),V is the node set, E is the edge set, and E is the subset of VV, then the iterative formula for TextRank is:

  

( ) ( )

1 ( )

j i

k j

ji

i j

v In v jk

v Out v

w

S v d d S v

w

 

   

 

(1)

i

v is a node, S v( )i is the weight of the node, In v( )i is the node set that points tovi,Out v( )j is the node

set pointed byvj,wjiis the power of nodeviandvj,d is the Damping Factor, we generally set it to 0.85.

The original literature did not take into account the attributes of the words themselves when using the TextRank algorithm to calculate the weight of words in keyword extraction. The initial weights of all words are assigned 1, and the weights of all sides are assigned 1. It uses an unweighted graph model which the word nodes are equally weighted. Thus, the formula for TextRank becomes:

  

 

  j

 

1 1

j i

i j

v In v

S v d d S v

Out v

   

(2)

Suppose the nodev1is connected tov2,and the nodev1is connected tov3,according to the above

formula, the weight of the nodev1is uniformly passed to the nodev2andv3, irrespective of the weights

of the nodev2andv3.However, obviously, the greater the importance of a word, the more it can

represent the statement, then when iterating for weights, it should be assigned more weights from neighboring nodes. Therefore, this paper improves the iterative formula of TextRank, and proposes a TextRank-RD algorithm for the computation of restricted domain similarity. The algorithm assigns an unbalanced initial value to each node, and assigns weights according to the importance of nodes when iterating. The iterative formula of TextRank-RD algorithm is as follows:

  

( ) ( )

1 ( )

j i

k j

i

i j

v In v k

v Out v

w

S v d d S v

w

 

   

 

(3)

i

wis the weight of nodevibefore this iteration.

When an unbalanced initial value is assigned to each node, the initial value is determined by the following three factors:

1) Whether the word is in the domain dictionary: This paper performs statement similarity calculation for a specific domain, the field dictionary contains some proprietary words in this field, these words are usually key words, can characterize statements well. Therefore, if words are in field dictionaries, their initial weights should be increased.

2) Word position: It is unfair to the words that at the first and the end of the sentence when the TextRank is voting. Because there is no word on the left of the word that at the first of the sentence to vote for it, and there is no word on the right of the word that at the end of the sentence to vote for it. For example, assume that a statement is made up of

w w w1, 2, 3, ,wn

, set the window size to 3,then

w w w1, 2, 3

,

w w w2, 3, 4

is all a window, w1andw3 in the first window, w3andw4 in the second

window will all vote onw2,andw1has only w2andw3 in the first window to vote on it, this is clearly

unfair tow1,the wordwn that at the end of the sentence is the same. However, the words at the

beginning and the end of the sentence are often more important. Therefore, this article will give more initial weights to the words at the head of the sentence and at the end of the sentence.

3) Part of speech. In a sentence, nouns indicate the names of people, things, places, or abstract things, it is used as the subject or object in the sentence. Nouns contain more information[9], often as keywords. Thus, this article assigns greater initial weights to words that are nouns.

(4)

1) Text preprocessing. The text preprocessing mainly includes the word segmentation, part of speech tagging, retains important parts of speech, removes the stop word. First of all, using the Chinese Academy of Sciences NLPIR Chinese word segmentation system for word segmentation and part of speech, and add domain dictionary to improve word segmentation effect; Next, retain nouns, adjectives and adverbs, and remove other parts of speech; Finally, according to the disabled vocabulary filter out the stop word. The specific field of this paper is “the introduction of computer and the basic of programming”, and the special words in the field dictionary are mainly from after-school exercises and related information on some websites.

2) Synonym replacement. First, building a synonym index F according to synonyms and Baidu Encyclopedia, F contains many collections, each set consists of semantic similar terms, each set is represented by a word in the set; Then, on the basis of the first step, go through each word in each sentence, if the word is in a set, the word is replaced with a word that represents the set. For example, there is a set (concept, meaning, definition, thread) in F, the representation of the set is “concept”, if we traverse the word “definition”, and finds that “definition” is included in the collection, then replace “definition” with “concept”.

3) Building graph modelGV E, , V is the node set, which consists of the words generated in step

2, E V V. First, remove the repetitive words in each sentence, build a dictionary for each sentence, dictionary content is the word and its corresponding index, for example(computer,0);Second, a window is defined for the statementS

w w w1, 2, 3, ,wn

after the replacement of the synonyms, the

words within the window vote each other. For example, the window size is set to k, then

w w w1, 2, 3, ,wk

,

w w w2, 3, 4, ,wk1

,

w w w3, 4, 5, ,wk2

are all windows, there is an undirected edge

between the nodes corresponding to any two words within a window. In this paper, the matrix M is used to store the graph G, if two words are in the same window, through the dictionary to find the index of the two words is i,j, the value of elementmi j, in matrix M is assigned 1, otherwise 0.

4) TextRank-RD iteration calculation. Firstly, the initial weights are given to the words according to the part of speech, the location of the words, and whether they are in the field dictionary, and then a weight dictionary is built. Next, read the graph model G and get the node set Out(v) and In(v) of each node; Finally, we use Out(v),In(v) and the weight dictionary generated by step 3 to iterate according to the formula until the maximum number of iterations or convergence is reached. This paper uses a binary weighting method proposed by Li Sujian, Wang Houfeng[10]to make initial weighting of words according to the part of speech, the location of words, and whether they are in field Dictionaries. The method sets each factor into a binary bit, and if a factor satisfies the condition, the binary position of the factor is set to 1, otherwise 0 is placed. Whether in the domain dictionary is the factor A, at the head of the sentence or at the end of the sentence is the factor B, and whether is a noun is the factor C. Suppose the bits are arranged in ABC, if the word w in the domain dictionary, located in the first sentence, not a noun, the binary number corresponding to the word W is 110, with a value of 6.

5) Sentence similarity calculation. First, traverse all statements and create an index dictionary. The vector space is established based on the index dictionaries and the final weights obtained from step 4, the representation of each statement S in the vector space is:

1, 2, 3, , n

Sp p p  p (4)

i

p is the weight of the word corresponding to index i, the weight is generated by step 4, if statement S does not contain the word corresponding to index i, then the value ofpi is 0. Secondly, according to

the formula to calculate the cosine angle between the two vectors, and then complete the calculation of the similarity of the statements. Suppose S1

p11,p12,p13, , p1n

,S2

p21,p22,p23, , p2n

, then the

(5)

1 1 2 1 2

2 2 1 2 1 1

,

n

k k

k

n n

k k

k k

p p Sim S S

p p

 

 

  

  

  

(5)

Experimental Results

The data set used in this paper is 200 after-school questions from the “the introduction of computer and the basic of programming” and some websites. The first sentence in each pair is the original question, and the second is the rewriting of the question.

In the initial assignment phase of TextRank-RD, the three factors which are whether the word is in the domain dictionary, whether the word is a noun and its position will affect the initial weights. The factors that have a front position have a large impact on the final outcome, more important factors should obviously be more forward. Therefore, we first experimentally validates the order of the importance of these three factors. The experimental method is that each time we only consider a single factor, and use the TextRank-RD algorithm based on the vector space model to calculate the similarity of each pair questions. For example, if the word w is in the domain dictionary, its initial weight is assigned 1, otherwise 0, then we perform statement similarity calculation. Three independent statements similarity calculations are made like this, each time only consider one factor, compare the similarity calculation results for each pair of statements. The results are shown in Figure 1.

[image:5.612.81.530.343.529.2]

Figure 1. Factor importance. Figure 2. Similarity experimental result. From the experimental results, it can be seen that whether in the domain dictionary has the greatest impact on the final results, the part of speech and the location of words have almost the same effect on the final result. Thus, this article places the factor whether in the domain dictionary(A) in the first place of the binary number, whether is a noun(B) in the second place, whether at the head or the end of the sentence(C) in the third place. That is, the final order is ABC.

(6)

Conclusion

Based on the vector space model, this paper improves the TextRank algorithm, and proposes a new algorithm TextRank-RD for sentence similarity calculation for restricted domain. The algorithm combines with Baidu Encyclopedia and synonym dictionary for synonym replacement, assign an initial weight to the word according to whether the word is in the domain dictionary, whether the word is a noun and its position, and improves the iterative formula, use a weighted graph model with weight distribution by node importance rather than an unweighted graph model. The final experimental results show that the proposed TextRank-RD algorithm based on vector space model has a higher accuracy compared with the traditional TF-IDF algorithm based on vector space model. This is of great significance to the similarity calculation of statements in automatic question answering system.

References

[1] Aizawa A. An information-theoretic perspective of tf–idf measures [J]. Information Processing & Management, 2003, 39(1): 45-65

[2] Mitchell J., Lapata M. Vector-based Models of Semantic Composition [C]//ACL. 2008: 236-244. [3] Zhang W., Yoshida T., Tang X. A comparative study of TF* IDF, LSI and multi-words for text classification [J]. Expert Systems with Applications, 2011, 38(3): 2758-2765.

[4] Soucy P., Mineau G.W. Beyond TFIDF weighting for text categorization in the vector space model [C]// International Joint Conference on Artificial Intelligence. Morgan Kaufmann Publishers Inc. 2005: 1130-1135.

[5] Mihalcea R., Tarau P. TextRank: Bringing order into texts [C]. Association for Computational Linguistics, 2004.

[6] Li G., Wang H. Improved Automatic Keyword Extraction Based on TextRank Using Domain Knowledge[M]//Natural Language Processing and Chinese Computing. Springer Berlin Heidelberg, 2014: 403-413.

[7] Wei Lu, Qikai Cheng. An information retrieval model based on weighted network and sentence window scheme [J]. Journal of information, 2013, 32(8): 797-804.

[8] Shanshan Yu, Jingdian Su, Pengfei Li. Automatic abstract extraction method based on improved TextRank [J]. Computer Science,2016, 43(6): 240-247.

[9] Wenbin Tan, Taihua Zhang,Erbao He. Similarity calculation of product comment statement based on multi feature fusion [J]. Journal of Guizhou Normal University: Natural Science Edition, 2016, 34(1): 81-87.

Figure

Figure 1. Factor importance.                                                 Figure 2

References

Related documents

4.1 The Select Committee is asked to consider the proposed development of the Customer Service Function, the recommended service delivery option and the investment required8. It

The key segments in the mattress industry in India are; Natural latex foam, Memory foam, PU foam, Inner spring and Rubberized coir.. Natural Latex mattresses are

The PROMs questionnaire used in the national programme, contains several elements; the EQ-5D measure, which forms the basis for all individual procedure

Chi-squared test and degrees of freedom (in parentheses) are reported for the splines measuring the nonlinear effect of the time since the previous PGM observation..

The aim of the Association is to create a forum for DFIs in Nigeria to discuss and exchange ideas on issues of common interest, provide a platform for members to co-operate

Recognition Program - PRP) based on points = points for BSN, certification, research (Recognizing Nursing Professional Growth and Development in a Collective Bargaining

For the poorest farmers in eastern India, then, the benefits of groundwater irrigation have come through three routes: in large part, through purchased pump irrigation and, in a

• Follow up with your employer each reporting period to ensure your hours are reported on a regular basis?. • Discuss your progress with