Abstract:
A natural language analysis method for an electronic device is provided. The language analysis method includes the steps of: receiving user inputs and generating signals; converting signals into textual information; segmenting the textual information into a number of vocabulary segments, each vocabulary segment including a number of separated vocabularies; retrieving the use frequency of each of vocabulary, sorting the vocabulary segments, and obtaining a first sorting of the number of vocabulary segments into descending order; segmenting the textual information into a number of sentence segmentations; obtaining a second sorting of the vocabulary segmentations, according to the number of sentence segmentations and the number of vocabulary segment results; and determining a reply to the textual information, according to the topmost result after the second sorting. An electronic device using the language analysis method is also provided.

Description:
BACKGROUND 
       [0001]    1. Technical Field 
         [0002]    The present disclosure relates to an electronic device and a natural language analysis method thereof. 
         [0003]    2. Description of Related Art 
         [0004]    Some electronic devices with human-machine dialogue function, such as mobile phones, laptops, tablets, for example, are capable of voice interaction with users. How to exactly understand the natural language of users has been the challenge in artificial intelligence discipline for a long time. During the human-machine dialogue process, the electronic device segments a sentence of the user into pieces of words and/or phrases, analyzes the meanings of the sentence to exclude unreasonable meaning(s), then creates a machine readable interpretation language such as binary language, that is associated with the sentence of the user. The electronic device then understands the sentence of the user by using the created machine readable language and a vocabulary pre-stored therein, thus to obtain the meanings of the sentence of the user. However, misunderstandings often happen because of the complex nature of human language, in respect of accents and dialects. 
         [0005]    Therefore, what is needed is an electronic device and a natural language analysis method thereof to alleviate the limitations described above. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0006]    The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the present disclosure. Moreover, in the drawings, like reference numerals designate corresponding sections throughout the several views. 
           [0007]      FIG. 1  is a block diagram of an electronic device in accordance with an exemplary embodiment. 
           [0008]      FIG. 2  is a flowchart of a natural language analysis method for electronic devices, such as the one of  FIG. 1 , in accordance with the exemplary embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0009]      FIG. 1  is an exemplary embodiment of a block diagram of an electronic device  100 . Compared to the electronic devices of related art, the electronic device  100  can more accurately understand the natural language of users, and has higher efficiency in human-machine dialogues. The electronic device  100  is a computing device such as a computer or a laptop. In alternative embodiments, the electronic device  100  can be other electronic devices with human-machine dialogue functions, such as a mobile phone, or a tablet, for example. 
         [0010]    The electronic device  100  includes a storage unit  10 , an input unit  20 , a processor  30 , a display unit  50 , and an audio output unit  60 . The storage unit  10  stores a collection of languages in one body (corpus  12 ) recording vast amount of vocabularies: words and phrases, and the use frequency of each word and each phrase. The corpus  12  is a collection of materials on language use which is selected and sequenced according to linguistic criterium. The corpus  12  is also a huge text database which is machine readable and is collected according to a particular design criterium. In the embodiment, the corpus  12  is a text database storing a huge number of Chinese natural languages. In other embodiments, the text databases of the kinds of language stored in the corpus  12  can be varied according to actual need, the corpus  12  can be a text database storing a huge number of the natural languages of English, of Japanese, or of others. 
         [0011]    The input unit  20  generates signals in response to a user&#39;s voice and/or written character input, and transmits the signals to the processor  30 . In the embodiment, the signals can be audio signals and/or character signals. 
         [0012]    The processor  30  includes a voice and character converting module  31 , a vocabulary segmentation module  32 , a sentence analysis module  33 , and an analysis control module  34 . 
         [0013]    When the electronic device  100  is powered on, the input unit  20  is activated and the user can talk to the electronic device  100  via the input unit  20 , in the manner hereinafter described. 
         [0014]    The voice and character converting module  31  converts the audio signals and/or character signals from the input unit  20  into a textualized message in a predetermined language. In the embodiment, the textualized message can include one or more words, one or more phrases, one or more sentences, and/or one or more paragraphs of a text, and the predetermined language is Chinese. In an alternative embodiment, the predetermined language can be English, or Japanese, or other language. 
         [0015]    The vocabulary segmentation module  32  segments and divides the textualized message from the voice and character converting module  31  into one or more vocabularies, and obtains one or more segments including the one or more vocabularies. The vocabularized segments are further transmitted to the analysis control module  34 . In the embodiment, the vocabulary segmentation module  32  segments the textualized message according to the bi-directional maximum matching method. That is, the vocabulary segmentation module  32  segments the textualized message forwardly and also reversely. For example, if the textualized message includes the sentence “the tiger killed the hunter&#39;s dog”, the vocabulary segmentation module  32  first segments the textualized message forwardly, and obtains one or more vocabularized segments. One segmented result may include the following vocabularies: “the tiger”, “killed”, “the hunter&#39;s”, and “dog”. Another segmented result may include the following vocabularies: “the tiger killed”, “the hunter&#39;s”, and “dog”. Yet another segmented result may include the following vocabularies: “the tiger killed the hunter” “&#39;s dog”, or “the tiger”, “killed”, “the hunter&#39;s dog”. The vocabulary segmentation module  32  then segments the textualized message reversely, and obtains one or more vocabularized segments. The segmented result may include the following vocabularies: “the dog”, “the hunter&#39;s”, “killed”, and “the tiger”. Yet another segmented result may include the following vocabularies: “the dog”, “the hunter&#39;s”, “killed the tiger.”. 
         [0016]    The analysis control module  34  retrieves the use frequency of each vocabularized segment created by the vocabulary segmentation module  32 , from the corpus  12  stored in the storage unit  10 . The analysis control module  34  also calculates a first probability value of each vocabularized segment based on the retrieved use frequency of each vocabularized segment, and obtains a first sequence of the language analysis results sequenced according to the first probability values of the vocabularized segments. In the embodiment, each segmented result is associated with a language analysis result. The larger the first probability value is, the nearer (more precise) or exact (correct) understanding of the user&#39;s meaning obtained according to the associated language analysis result. That is to say, the analysis control module  34  sequences the vocabularized segments according to the descending order of their probability values, and the language analysis result associated with the greatest first probability value is the first in the sequence downwards. In other words, the nearest or exact language analysis result is at the top. 
         [0017]    The sentence analysis module  33  segments the textualized message from the voice and character converting module  31  based on the results obtained by the vocabulary segmentation module  32  and a sentence construction rule, and obtaining one or more sentence segments. The sentence analysis module  33  further transmits the sentence segments back to the analysis control module  34 . 
         [0018]    The analysis control module  34  further calculates a second probability value of each vocabularized segments based on the sentence segments, and adjusts the first sequence of the language analysis results according to the second probability values of the vocabularized segments, to obtain a second sequence of the language analysis results. In one embodiment, the analysis control module  34  excludes the vocabularized segments with the lowest second probability value, and deletes the associated language analysis result. In the embodiment, the smaller the second probability value of the sentence segment is, the farther is the deviation from correctly understanding the user&#39;s original meaning. 
         [0019]    The processor  30  further includes a paragraph analysis module  35  which analyzes a number of textualized messages converted within a predetermined time period, including the original textualized message, according to a contextual understanding method, obtains one or more paragraph analysis results, and transmits the paragraph analysis results back to the analysis control module  34 . 
         [0020]    The analysis control module  34  further calculates a third probability value of each vocabularized segments based on the paragraph analysis results, adjusts the second sequence of the language analysis results according to the third probability values, and obtains a third sequence of the language analysis results. In one embodiment, the analysis control module  34  excludes the vocabularized segments(s) with the lowest third probability value, and deletes the associated language analysis result(s). 
         [0021]    The processor  30  further includes an intelligent conversation module  36  which determines a message in reply (reply message) based on the language analysis result sequenced on the top, and the corpus  12 . In the embodiment, the language analysis result which is finally at the top is the basis for the message in reply. 
         [0022]    The voice and character converting module  31  further converts the reply message determined by the intelligent conversation module  36  into a reply message and/or corresponding vocal expression, and controls the display unit  50  to display the reply message and/or the audio output unit  60  to play the corresponding vocal expression. 
         [0023]    The electronic device  100  further includes a buffer  40  used for temporarily storing certain data, namely, the reply message converted by the voice and character converting module  31 , the vocabularies and the vocabularized segments segmented by the vocabulary segmentation module  32 , the sentence segments segmented by the sentence analysis module  33 , the paragraph analysis results analyzed by the paragraph analysis module  35 , and the probability values of the vocabularized segments and the sequences obtained by the analysis control module  34 . 
         [0024]      FIG. 2  shows a flowchart of a natural language analysis method for the electronic device  100  of  FIG. 1 . The electronic device  100  stores a corpus  12  recording vast amount of vocabularies: words and phrases, and the use frequency of each word and each phrase. The method includes the following steps, each of which is related to the various components contained in the electronic device  100 : 
         [0025]    In step S 20 , the input unit  20  generates signals in response to a user&#39;s voice and/or written character input. In the embodiment, the signals can be the sound of a voice and/or character signals. 
         [0026]    In step S 21 , the voice and character converting module  31  converts the audio signals and/or character signals generated by the input unit  20  into a textualized message in a predetermined language. In the embodiment, the textualized message can include a word, a phrase, a sentence, and/or a paragraph, and the predetermined language is Chinese. 
         [0027]    In step S 22 , the vocabulary segmentation module  32  segments the textualized message from the voice and character converting module  31  into one or more vocabularies, and obtains one or more vocabularized segments. 
         [0028]    In step S 23 , the analysis control module  34  retrieves the use frequency of each vocabularized segment from the corpus  12 , calculates a first probability value of each vocabularized segment based on the retrieved use frequency of each segment of vocabulary, and obtains a first sequence of the language analysis results sequenced in descending order according to the first probability values. 
         [0029]    In step S 24 , the sentence analysis module  33  segments the textualized message converted by the voice and character converting module  31  based on a sentence construction rule, and obtains one or more sentence segments. 
         [0030]    In step S 25 , the analysis control module  34  calculates a second probability value of each sentence segment, and adjusts the first sequence of the language analysis results according to the second probability values, to obtain a second sequence of language analysis results. 
         [0031]    In step S 26 , the paragraph analysis module  35  analyzes a number of textualized messages converted within a predetermined time period to include the original textualized message according to a contextual understanding method, and obtains one or more paragraph analysis results. In the embodiment, it is the total number of textualized messages which are generated within a predetermined time period and includes the original textualized message. 
         [0032]    In step S 27 , the analysis control module  34  calculates a third probability value of each vocabularized segment based on the paragraph analysis results, and adjusts the second sequence of the language analysis results according to the third probability values, to obtain a third sequence of the language analysis results. 
         [0033]    In step S 28 , the intelligent conversation module  36  determines a reply message for the textualized message based on the optimum final language analysis result (the result at the top) and the corpus  12 . In one embodiment, the language analysis result finally on top is the one sequenced according to the second sequence. 
         [0034]    In step S 29 , the voice and character converting module  31  converts the reply message determined by the intelligent conversation module  36  into a reply message and/or sound of a human voice, and controls the display unit  50  to display the reply message and/or play the sound of a human voice through the audio output unit  60 . 
         [0035]    With such a configuration, the electronic device  100  is more able to understand the meanings of user&#39;s language, and vocal communication between the user and the electronic device  100  is more efficient. 
         [0036]    Although the present disclosure has been specifically described on the basis of the embodiments thereof, the disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the embodiments without departing from the scope and spirit of the disclosure.