JPH04100151A - Expert system string reference method - Google Patents
Expert system string reference methodInfo
- Publication number
- JPH04100151A JPH04100151A JP2153976A JP15397690A JPH04100151A JP H04100151 A JPH04100151 A JP H04100151A JP 2153976 A JP2153976 A JP 2153976A JP 15397690 A JP15397690 A JP 15397690A JP H04100151 A JPH04100151 A JP H04100151A
- Authority
- JP
- Japan
- Prior art keywords
- inference
- string
- strings
- character string
- expert system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.
Description
【発明の詳細な説明】
[産業上の利用分野]
本発明はエキスパートシステムに関し、特に自然言語の
形でユーザとの対話を行うエキスパートシステムの文字
列参照方法に関する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an expert system, and more particularly to a string reference method for an expert system that interacts with a user in the form of natural language.
【従来の技術]
従来のエキスパートシステムは、入出力部、推論部、知
識ベースから成っている。[Prior Art] A conventional expert system consists of an input/output section, an inference section, and a knowledge base.
入出力部は自然言語の形で推論対象に関する事実データ
を入力しく以下、入力事実データを入力事象と記す)、
推論結果をCRT上に表示する。The input/output unit inputs factual data regarding the inference target in the form of natural language (hereinafter, the input factual data will be referred to as input event),
The inference results are displayed on the CRT.
推論部は、IF部とThen部で成る推論ルールを用い
て、IF部の命題が成立する推論ルールを探索し、その
推論ルールのThen部の命題を結論として出力する。The inference section uses an inference rule consisting of an IF section and a then section to search for an inference rule for which the proposition in the IF section holds true, and outputs the proposition in the then section of the inference rule as a conclusion.
IF部の命題が成立するか否かは事実データを参照して
判断する。以下、IF部およびThen部を記述する命
題をそれぞれその推論ルールの事象、結論と記す、事象
が成立する推論ルールであっても、その結論が、解決し
ようとする問題に答えていない場合には、その結論を入
力事象として次の推論ルールを探索する。このように、
ある推論の結果得られた結論を入力事象として次の推論
に弓継ぎ、問題に答える結論、すなわち目標結論が得ら
れるまで推論を繰り返す推論は多段推論と呼ばれ、ある
推論ルールの結論であって次の推論ルールの入力事象と
される命題は中間仮説と呼ばれている。Whether or not the proposition in the IF section holds true is determined by referring to factual data. Hereinafter, the propositions describing the IF part and the Then part will be referred to as the event and conclusion of the inference rule, respectively. Even if the inference rule holds the event, if the conclusion does not answer the problem to be solved. , and searches for the next inference rule using that conclusion as an input event. in this way,
An inference in which the conclusion obtained as a result of one inference is used as an input event and is connected to the next inference, and the inference is repeated until the conclusion that answers the problem, that is, the target conclusion is obtained, is called multistage inference, and is the conclusion of a certain inference rule. The proposition that is the input event for the next inference rule is called an intermediate hypothesis.
知識ベースはルールベースとデータベースで構成されて
いる。ルールベースは通常、磁気ディスク上に構成され
、推論ルールが格納されている。The knowledge base consists of a rule base and a database. A rule base is usually configured on a magnetic disk and stores inference rules.
データベースは事実データと中間仮説が格納される。The database stores factual data and intermediate hypotheses.
推論は、各々の推論ルールのIF部に事実データまたは
中間仮説を参照し、該事実データまたは中間仮説と一致
するIF部をもつ推論ルールを探索する問題に帰着する
にの探索は所定の探索アルゴリズムで実行され、探索ア
ルゴリズムは各々の推論ルールを接点とする探索木また
は各々の推論ルールを要素とするリストの形式で表現さ
れる。Inference refers to fact data or an intermediate hypothesis in the IF part of each inference rule, and the search results in a problem of searching for an inference rule having an IF part that matches the fact data or intermediate hypothesis.The search is performed using a predetermined search algorithm. The search algorithm is expressed in the form of a search tree with each inference rule as a contact point or a list with each inference rule as an element.
事実データまたは中間仮説とIF部の命題との参照は次
のように行われる。References between factual data or intermediate hypotheses and propositions in the IF section are made as follows.
今、推論ルールが次のように2つであるとする。Suppose that there are two inference rules as follows.
ルール(1):IF 天気==晴 Then 携帯
;帽子ルール(2):IF 天気:・雨 丁hen
携帯=傘この場合、各々の推論ルールを記述する言語
要素の文字列は、次のようになる。Rule (1): IF Weather == Sunny Then Mobile; Hat Rule (2): IF Weather:・Rain then
Cellphone = Umbrella In this case, the character strings of language elements that describe each inference rule are as follows.
ルール(1)・ 天気 晴 携帯 帽子ルール(2)
: 天気 雨 携帯 全事実データまたは中間仮説
が
天気・雨
であると、推論部は、先ず
(天気 晴)と(天気 雨)を参照し、次に、(天気
雨)と(天気 雨)を参照し、結論として
携帯・傘
を得る。このとき、漢字は、1字当り2バイトのアドレ
スで指定されるので、例えば(天気 晴)と(天気 雨
)との参照は、6バイトのコードを1バイトつづ参照す
ることによって行われる。Rule (1) Weather: Clear, Mobile Phone, Hat Rule (2)
: Weather Rain Mobile If all the factual data or the intermediate hypothesis is weather/rain, the inference section first refers to (weather clear) and (weather rain), and then (weather rain).
Refer to (rain) and (weather rain) and get a cell phone/umbrella as a conclusion. At this time, since each kanji character is specified by a 2-byte address, for example, (weather, clear) and (weather, rain) are referenced by referring to a 6-byte code one byte at a time.
[発明が解決しようとする課題〕
上記の従来のエキスパートシステムの文字列参照方法に
おいては、文字列ABCと文字列ABCDとが一致して
いるか否かを見るためには、すべての文字について先頭
から1バイトっづ比較しなければならないので、文字列
参照に時間がかかるばかりでなく、文字列の長さによっ
て参照時間が異なるといつ問題点がある。[Problem to be Solved by the Invention] In the above-mentioned conventional expert system character string reference method, in order to check whether character strings ABC and character strings ABCD match, it is necessary to check all characters from the beginning. Since each byte has to be compared, not only does it take time to reference strings, but there is also a problem if the reference time varies depending on the length of the string.
本発明は、参照時間が文字列の長さに依存せず、かつ、
高速の参照をすることができるエキスパートシステムの
文字列参照方法を提供することを目的とする。The present invention provides that the reference time does not depend on the length of the character string, and
The purpose of this invention is to provide a method for referencing strings in an expert system that allows high-speed referencing.
[課題を解決するための手段]
本発明のエキスパートシステムの文字列参照方法は、ル
ール型知識を有し、自然言語の形でユーザとの対話を行
うエキスパートシステムの文字列参照方法であって、
推論ルールを記述する言語要素の文字列を予め所定のメ
モリに蓄積し、
推論ルールをエキスパートシステムへ初期設定するとき
には、
推論ルールを記述する言語要素の文字列をエキスパート
システムに入力し、
所定の探索アルゴリズムに従って、前記メモリに記憶さ
れている文字列の集合から、入力文字列に合致する文字
列を探し出し、前記合致する文字列の、前記メモリ中に
おけるアドレスの先頭アドレスをデータとして生成し、
推論ルールを記述する言語要素の文字列に対応する前記
先頭アドレスを用いて推論ルールを記述し、
推論時には、
事実データを記述する言語要素の文字列をエキスパート
システムに入力し、
所定の探索アルゴリズムに従って、前記メモリに記憶さ
れている文字列の集合から、入力文字列に合致する文字
列を探し出し、前記合致する文字列の、前記メモリ中に
おけるアドレスの先頭アドレスをデータとして生成し、
事実データを記述する言語要素の文字列に対応する前記
先頭アドレスを用いて事実データを記述し、
推論の際、推論ルールおよび事実データを記述する言語
要素の文字列の参照を、前記先頭アドレスを参照するこ
とによって行う。[Means for Solving the Problems] A character string reference method for an expert system of the present invention is a character string reference method for an expert system that has rule-based knowledge and interacts with a user in the form of natural language, comprising: Strings of language elements that describe inference rules are stored in a predetermined memory in advance, and when initializing the inference rules to an expert system, the strings of language elements that describe inference rules are input to the expert system, and a predetermined search is performed. According to an algorithm, a character string that matches the input character string is searched from a set of character strings stored in the memory, and the first address of the address in the memory of the matching character string is generated as data, and an inference rule An inference rule is written using the above-mentioned start address corresponding to a character string of a language element that describes factual data, and at the time of inference, the character string of a language element that describes factual data is input to the expert system, and according to a predetermined search algorithm, the above-mentioned A language that searches for a character string that matches an input character string from a set of character strings stored in memory, generates the first address of the matching character string in the memory as data, and describes factual data. Fact data is described using the first address corresponding to the character string of the element, and during inference, the character string of the language element that describes the inference rule and fact data is referenced by referring to the first address.
[作 用]
本発明のエキスパートシステムの文字列参照方法におい
ては、推論ルールを記述する言語要素の文字列、すなわ
ち事象および結論を記述する言語要素の文字列と、事実
データ、すなわち入力事象の文字列とを、メモリ上の対
応する文字列の先頭アドレス(以下、トークンと記す)
に対応させる。トークンは、文字列毎に異なり、かつ、
それぞれの文字列に対して一義的に定まるので、このト
ークンを対応する文字列の識別コートとして使用するこ
とができる。したがって推論の際の、結論または中間仮
説と次の推論ルールの事象との参照は、それぞれのトー
クンを参照することによって達成される。[Operation] In the character string reference method of the expert system of the present invention, character strings of language elements that describe inference rules, that is, character strings of language elements that describe events and conclusions, and factual data, that is, characters of input events. column and the start address of the corresponding string in memory (hereinafter referred to as a token)
correspond to The token is different for each string, and
Since it is uniquely determined for each character string, this token can be used as an identification code for the corresponding character string. Therefore, during inference, reference between the conclusion or intermediate hypothesis and the event of the next inference rule is achieved by referring to the respective tokens.
トークンは文字列の長さに依存しない、通常は4バイト
のコードであるので、文字列の参照は文字列の長さに無
関係に、通常は4バイトのみの参照で完了する。Since the token is usually a 4-byte code that does not depend on the length of the string, referencing the string is usually completed by referencing only 4 bytes, regardless of the length of the string.
[実施例]
次(二本発明の実施例について図面を参照して説明する
。[Embodiments] Next, two embodiments of the present invention will be described with reference to the drawings.
第1図は本発明のエキスパートシステムの文字列参照方
法を適用したエキスパー トシステムの一実施例のブロ
ック図、第2図は文字列管理形式を示す文字刊本である
。FIG. 1 is a block diagram of an embodiment of an expert system to which the character string referencing method of the expert system of the present invention is applied, and FIG. 2 is a text book showing a character string management format.
本実施例のエキスパートシステムは、入出力部1、参照
部2.推論部3.知識ベース4によって構成されている
。このうち、入出力部1.推論部3、知識ベース4は[
従来の技術]の項に記載されているものと同じ機能をも
ち、同様の動作をする。The expert system of this embodiment includes an input/output section 1, a reference section 2. Reasoning part 3. It is composed of knowledge base 4. Among these, input/output section 1. The inference unit 3 and the knowledge base 4 are [
It has the same functions and operates in the same way as those described in the section ``Prior Art''.
参照部2はメモリを備え、該メモリには推論ルールを記
述する言語要素の文字列の集合が記憶されている。この
文字列の集合は、第2図の文字刊本の形式で管理されて
いる。推論ルールおよび事実データを記述する言語要素
の文字列が入出力部1を介して入力されると、参照部2
は、第2図の文字刊本に対応する探索アルゴリズムに従
って、前記メモリに記憶された文字列の集合から入力文
字列に合致する文字列を探し出し、該文字列の、前記メ
モリ中のアドレスの先頭アドレス(4バイト)、すなわ
ち1・−クンをデータとして出力する。トークンは、入
力文字列の識別コードとして使用される。The reference unit 2 includes a memory in which a set of character strings of language elements describing inference rules is stored. This collection of character strings is managed in the format of a text book as shown in FIG. When character strings of language elements describing inference rules and factual data are input through the input/output unit 1, the reference unit 2
searches for a character string that matches the input character string from the set of character strings stored in the memory according to the search algorithm corresponding to the text book shown in FIG. (4 bytes), that is, 1.-kun is output as data. The token is used as an identification code for the input string.
メモリ上の文字刊本を探索した結果、入力文字列に合致
する文字列がなかった場合には、当該文字列と同一の文
字列を新たにメモリに追加する。As a result of searching the printed books on the memory, if there is no character string matching the input character string, a new character string identical to the input character string is added to the memory.
新たに追加される文字列は、既に格納されている文字刊
本に節点を追加するようにアドレスが与えられる。新た
な文字列を文字刊本に追加するとき、同一の文字列が文
字刊本のなかに2つ存在しないこと、すなわち文字列の
一意性を保証するために、最大限の注意が払われる。こ
の保証はB木やハツシュ関数を用いることによって達成
される。Newly added strings are given addresses to add nodes to already stored strings. When adding new strings to a text book, maximum care is taken to ensure that no two identical strings exist in the text book, ie, the strings are unique. This guarantee is achieved by using B-trees and hash functions.
参照部2はさらに、入力文字列が推論ルールを記述する
言語要素の文字列であると判断した場合には、当該入力
文字列のトークンを、当該入力文字列が格納されるべき
ルールベース上のアドレスに伝送し、入力文字列が事実
データを記述する言語要素の文字列であると判断した場
合には、該入力文字列のトークンを、該入力文字列が格
納されるべきデータベース上のアドレスに伝送する。こ
のようにして、ルールベースおよびデータベースには、
トークンで表現された推論ルールおよび事実データが書
込まれる。また、推論ルールがトークンで表現されるの
で、多段推論の中間仮説もトークンで表現され、データ
ベースに格納される。Further, when the reference unit 2 determines that the input string is a string of a language element that describes an inference rule, the reference unit 2 stores the token of the input string on the rule base where the input string is to be stored. If the input string is determined to be a string of language elements describing factual data, the token of the input string is sent to the address on the database where the input string is to be stored. Transmit. In this way, rulebases and databases have
Inference rules and factual data expressed in tokens are written. Furthermore, since inference rules are expressed as tokens, intermediate hypotheses in multi-stage inference are also expressed as tokens and stored in the database.
次に本実施例の動作を説明する。Next, the operation of this embodiment will be explained.
先ず、エキスパートシステムの初期設定時に推論ルール
をルールベースに書込む。First, when initializing the expert system, inference rules are written into the rule base.
参照部2は、入出力部1を介して推論ルールの言語要素
の文字列を受付けると、文字列木を探索して該文字列の
トークンを生成する。さらに、参照部2は、入力文字列
が推論ルールの文字列であると判断すると、トークンを
ルールベースの当該入力文字列が格納されるべきアドレ
スに転送する。このようにして、トークンで記述された
推論ルールがルールベースに格納される。When the reference unit 2 receives a character string of a language element of an inference rule via the input/output unit 1, it searches a character string tree and generates a token for the character string. Furthermore, when the reference unit 2 determines that the input character string is a character string of an inference rule, it transfers the token to the address in the rule base where the input character string is to be stored. In this way, inference rules written in tokens are stored in the rule base.
次に推論時には、参照部2は、入出力部1を介して事実
データの言語要素の文字列を受付けると、文字列木を探
索して該文字列のトークンを生成する。さらに、参照部
2は、入力文字列が事実データであると判断すると、ト
ークンをデータベースの、当該入力文字列が格納される
べきアドレスに転送する。推論部はデータベースから、
トークンで記述された事実データを読み出し、ルールベ
ースからトークンで記述された推論ルールを読み出して
推論を行う。Next, at the time of inference, when the reference unit 2 receives a character string of a linguistic element of fact data via the input/output unit 1, it searches a character string tree and generates a token for the character string. Further, when the reference unit 2 determines that the input character string is factual data, it transfers the token to the address in the database where the input character string is to be stored. The inference section uses the database,
It reads fact data written in tokens, reads inference rules written in tokens from the rule base, and performs inference.
前記したように、エキスパートシステムが文字列の一意
性を保証すると、その文字列の先頭アドレスは一義的に
定まる。推論部3は、その先頭アドレスすなわちトーク
ンをその文字列の、エキスパートシステム内におけるユ
ニークな識別コートとしてトークンを参照して推論を進
める。その結果、推論部3は文字列がどのような長さで
あっても4バイトのトークンを比較するだけで文字列の
参照が完了する。As described above, when the expert system guarantees the uniqueness of a string, the start address of the string is uniquely determined. The inference unit 3 uses the start address, that is, the token, as a unique identification code for the character string within the expert system, and proceeds with the inference by referring to the token. As a result, no matter how long the string is, the reasoning unit 3 can complete the reference to the string by simply comparing 4-byte tokens.
上記の実施例においては、参照部2がメモリ上の文字列
の集合を本構造の管理形式で管理する場合を記したが他
の実施例として文字列をリスト構造の管理形式で管理す
ることができる。大切なことは、文字列集合の管理形式
ではなく、文字列の一意性である。もし、文字列の一意
性が保証されない場合には、文字列の一致を見逃がす事
態が生ずるからである。In the above embodiment, a case has been described in which the reference unit 2 manages a set of character strings in memory using the management format of this structure, but as another embodiment, it is also possible to manage character strings using a management format of a list structure. can. What is important is the uniqueness of the strings, not the management format of the string set. This is because if the uniqueness of character strings is not guaranteed, a match between character strings may be overlooked.
[発明の効果]
以上説明したように本発明は、推論ルールおよび事実デ
ータを記述する各文字列を、メモリ上の当該文字列の先
頭アドレスに対応させ、該先頭アドレスを当該文字列の
識別コードとして文字列の参照を行うことにより、文字
列の長さに無関係に、かつ、従来に比べて高速に、文字
列の参照を行うことができる効果がある。[Effects of the Invention] As explained above, the present invention makes each character string describing an inference rule and fact data correspond to the start address of the character string in memory, and associates the start address with the identification code of the character string. By referencing a character string as , there is an effect that the character string can be referenced regardless of the length of the character string and faster than in the past.
第1図は本発明のエキスパートシステムの文字列参照方
法を適用したエキスパートシステムの一実施例のブロッ
ク図、第2図は文字列の管理形式を示す文字列木である
。
1・・・入出力装置、
2・・・参照部、
3・・・推論部、
4・・・知識ベース。FIG. 1 is a block diagram of an embodiment of an expert system to which the expert system character string reference method of the present invention is applied, and FIG. 2 is a character string tree showing a character string management format. 1... Input/output device, 2... Reference section, 3... Reasoning section, 4... Knowledge base.
Claims (1)
話を行うエキスパートシステムの文字列参照方法におい
て、 推論ルールを記述する言語要素の文字列を予め所定のメ
モリに蓄積し、 推論ルールをエキスパートシステムへ初期設定するとき
には、 推論ルールを記述する言語要素の文字列をエキスパート
システムに入力し、 所定の探索アルゴリズムに従って、前記メモリに記憶さ
れている文字列の集合から、入力文字列に合致する文字
列を探し出し、前記合致する文字列の、前記メモリ中に
おけるアドレスの先頭アドレスをデータとして生成し、 推論ルールを記述する言語要素の文字列に対応する前記
先頭アドレスを用いて推論ルールを記述し、 推論時には、 事実データを記述する言語要素の文字列をエキスパート
システムに入力し、 所定の探索アルゴリズムに従って、前記メモリに記憶さ
れている文字列の集合から、入力文字列に合致する文字
列を探し出し、前記合致する文字列の、前記メモリ中に
おけるアドレスの先頭アドレスをデータとして生成し、 事実データを記述する言語要素の文字列に対応する前記
先頭アドレスを用いて事実データを記述し、 推論の際、推論ルールおよび事実データを記述する言語
要素の文字列の参照を、前記先頭アドレスを参照するこ
とによって行なうことを特徴とするエキスパートシステ
ムの文字列参照方法。[Claims] 1. In a string reference method for an expert system that has rule-based knowledge and interacts with a user in the form of natural language, a string of language elements describing inference rules is stored in a predetermined memory in advance. When initializing the inference rules in the expert system, the strings of language elements that describe the inference rules are input to the expert system, and according to a predetermined search algorithm, the strings are extracted from the set of strings stored in the memory. , finds a string that matches the input string, generates the starting address of the matching string in the memory as data, and generates the starting address corresponding to the string of the language element that describes the inference rule. At the time of inference, input strings of language elements that describe factual data into the expert system, and select input strings from the set of strings stored in the memory according to a predetermined search algorithm. Find a character string that matches, generate the start address of the matching character string in the memory as data, and write the fact data using the start address corresponding to the character string of the language element that describes the fact data. A method for referring to strings in an expert system, characterized in that, during inference, a string of a language element that describes an inference rule and fact data is referenced by referring to the start address.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2153976A JPH04100151A (en) | 1990-06-14 | 1990-06-14 | Expert system string reference method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2153976A JPH04100151A (en) | 1990-06-14 | 1990-06-14 | Expert system string reference method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH04100151A true JPH04100151A (en) | 1992-04-02 |
Family
ID=15574196
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2153976A Pending JPH04100151A (en) | 1990-06-14 | 1990-06-14 | Expert system string reference method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH04100151A (en) |
-
1990
- 1990-06-14 JP JP2153976A patent/JPH04100151A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5721899A (en) | Retrieval apparatus using compressed trie node and retrieval method thereof | |
| JP2718881B2 (en) | Token identification system | |
| US6728705B2 (en) | System and method for selecting content for displaying over the internet based upon some user input | |
| CN102867049B (en) | Chinese PINYIN quick word segmentation method based on word search tree | |
| US7707135B2 (en) | Enhanced artificial intelligence language | |
| JPH04100151A (en) | Expert system string reference method | |
| CN118114660A (en) | Text detection method, system and computer readable storage medium | |
| JPS6068435A (en) | How to search for software parts | |
| CN110851612B (en) | Mobile application knowledge graph composite completion method and device based on encyclopedia knowledge | |
| JPH03116375A (en) | Information retriever | |
| JPS6049931B2 (en) | Information search method | |
| CN116010422B (en) | A data processing method and apparatus based on data dependency | |
| JP2722684B2 (en) | File system search device | |
| JP2000163433A (en) | Synonym registration management system | |
| JP2001117929A (en) | Data search method, data alignment method, and data search device | |
| JPS6261118A (en) | Retrieving system for tree structure index | |
| JP2002132809A (en) | Character string search method, device for executing the method, and recording medium storing the processing program | |
| JPH06274701A (en) | Word collating device | |
| JP2002063202A (en) | Information retrieving system and its method | |
| JPH03127254A (en) | Word retrieving device | |
| JPH02244380A (en) | Data base system | |
| JPS63229523A (en) | information processing equipment | |
| CN115809664A (en) | Word segmentation processing method and device, electronic equipment and storage medium | |
| JPH06274545A (en) | Retrieval system | |
| JPH06203077A (en) | Electronic dictionary |