METHOD FOR PROCESSING KNOWLEDGE OR INFORMATION, DEVICE, AND COMPUTER PROGRAM

20170206455 ยท 2017-07-20

    Inventors

    Cpc classification

    International classification

    Abstract

    To use a computer to automatically process knowledge in the same manner as Prolog, the knowledge being expressed in a format wherein variables are embedded in natural language, and to achieve comprehensive deduction and solution searching at the predicate logic level. As in the input of Prolog facts, rules, and goals, in the present invention a person uses character types, delimiters, or escape characters to distinguish the constant portions and the variable portions of content that is equivalent to literal in Prolog and inputs the content into a computer. The computer performs automatic unification and/or automatic derivation on text included in the input while treating variables as material that could span the boundaries of the subject, predicate, etc. of the text.

    Claims

    1. A processing method for causing a computer to automatically execute all of or a part of a function of a logic programming language PROLOG, the method comprising: manually inputting fact, rule or goal of PROLOG to the computer in discerning a constant part and a variable part corresponding to literal of PROLOG (referred as sentence hereafter) by a character type, a delimiter or an escape character; and by computer, executing an automatic unification process, an automatic derivation process or both of them in the sentence included in the input of the fact, rule or goal, handling a variable as what may straddle a boundary of a subject clause, a predicate clause, a subject, a predicate, an object, a complement, a modifier of an inflectable word or a sentence.

    2. The processing method as claimed in claim 1, comprising, in the automatic unification process: recursively repeating a unification of patterns (whose constant part and variable part are distinguished by a character type, a delimiter or an escape character) as sentences that may include variables and a sentence that does not include variables until it comes to have no variable in a constant manner; calculating a longest matching solution (ex. TaroandJiro) of the variable (ex. $X) that appears in the pattern (ex. $Xand$Ylike$Z) firstly (or lastly), followed by storing each status ($X=TaroandJiro>TaroandJi>Taroand>Taro>Ta>Null) of the solutions, which is a base condition to generate a new pattern, as to each of the new pattern (ex. TaroandJiroand$Ylike$Z>TaroandJiand$Ylike$Z>TaroAndand$Ylike$Z>Taroand$Ylike$Z>Taand$sYlike$Z>and$Ylike$Z) obtained by assigning the process (ex. TaroandJiro>TaroandJi>TaroandJi>Taroand>Taro>Ta>Null) eliminating characters of the character string of the longest matching solution from its rear (or its beginning) to a null character in the eliminating process; and obtaining different answers (e.g., Answer 1=($X=TaroandJiro, SY=Sabro), answer 2=($X=Taro, SY=JiroandSaburo) of different unifications by integrating the status of each unified halfway solution (e.g., truth ($X=TaroandJiro, $Y=Saburo), truth ($X=Taro, $Y=JiroandSaburo)) when there is no more variable.

    3. The processing method as claimed in claim 2, comprising: gradually eliminating characters just until a shortest matching solution obtained separately, instead of gradually reducing to the null character.

    4. The processing method as claimed in claim 2, comprising: gradually eliminating until the character gets null; gradually eliminating the characters until the character gets null and the longest matching solution includes one character C that is a fixed character appearing just after (or just before) the variable appears first (or last) in the pattern; and eliminating partial character strings ranging from the last (or first) to the first C met of the longest matching solution, including the C; wherein this one character C is the first (or the last) character C of the solution candidate that is assigned to the other variable as a solution candidate when the character appearing just after (or just before) is the other variable and the solution is not a null character.

    5. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: obtaining a restriction information that is the goal (including a sub goal, the same applying hereafter); obtaining the restriction information about each sentence constituting the goal independently; and giving a return value true and its product set when the product set of each restriction information is not empty.

    6. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: obtaining a restriction information that is goal; defining an existing restriction information as null first; reducing recursively a sentence aggregation included in the goal, by executing an automatic calculation regarding whether the one sentence can be true under application of an existing restriction information and also additional restriction information to be true; eliminating the one sentence while adding the additional restriction information to the existing restriction information; and defining the existing restriction information as goal when the sentence aggregation keeping possibility to be true turns to an empty set.

    7. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: unifying the pattern not including a variable and the fact not including a variable; returning true when the pattern and the fact match each other as a character string; and returning false when the pattern and the fact do not match each other as a character string.

    8. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: unifying the pattern not including a variable and the fact not including a variable; when the pattern and the fact match each other as a character string, returning the result of application of processing method wherein defining body part of the Horn clause as the sub goal; and when the pattern and the fact do not match each other as a character string, returning false.

    9. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: unifying a pattern not including a variable and a Horn clause having the head part including a variable; on each restriction information obtained by using the pattern as the constant character string in the processing method and using the head part as the pattern in the same processing method, returning true when what can be true exists after the restriction information is applied to the body part of the Horn clause and the resulted body is processed as sub goal of the processing method; and returning false if not.

    10. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: unifying a pattern including a variable and a fact not including a variable; and returning a result processed by executing processing by using the pattern as the pattern in the processing method and by using the fact as the constant character string in the same processing method.

    11. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: unifying a pattern including a variable and a Horn clause having a head part not including a variable; returning true together with restriction information (C) in case that the restriction information (C) exists which takes a true result processed by using said pattern as the pattern in the processing method, and using the head part as the constant character string in the same processing method, and that the result processed by taking the body part of the Horn clause as sub goal of the processing method is true.

    12. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: unifying a pattern including a variable and a Horn clause having a head part including a variable; and returning false when the pattern and the head part do not match each other as to the fixed characters for the number of characters existing in the head or tail or the both.

    13. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: when unifying a first pattern including a variable and a Horn clause having a head part including a variable and also the pattern and the head part match each other as for the number of fixed characters existing in the head and the tail of them, and when whose second patterns (obtained by restricting the head part of the Horn clause with restriction information whose result of applying the body part of the Horn clause as sub goal in the processing method are true) do not include a variable, returning the result processed by using the first pattern as the pattern of the processing method and by using the second pattern as the constant character string in the same processing method.

    14. The processing method as claimed in claim 1, wherein a computer restricts input of a fact including a variable.

    15. The processing method as claimed in claim 1, wherein a rule is substantially in the same form with what is called Horn clause and a computer limits a head part to include a variable that does not appear in a body part.

    16. The processing method as claimed in claim 1, wherein, in the automatic unification process or the automatic derivation process, the automatic unification process of a pattern and a head part or a fact respectively having a variable that remains non-restricted, is conducted by obtaining and returning a set of solutions that are the minimum as a fixed character string.

    17. The processing method as claimed in claim 1, wherein, in the automatic unification process or the automatic derivation process, the automatic unification process of a pattern and a head part or a fact respectively having a variable that is not restricted being remained, is conducted by obtaining and returning a set of solutions that are the minimum as the character string including a variable.

    18. The processing method as claimed in claim 16, comprising: when a fixed character for the number of characters existing commonly in head or tail of a character string in a pattern and a head part or a fact respectively having a variable that remains non-restricted do not match each other, returning false.

    19. The processing method as claimed in claim 16, comprising: obtaining a set of solutions to be the minimum as a fixed character string or a character string including a variable; affirming that a variable included in both character strings (referred to as a first character string and a second character string) constituted with a pattern and a head part or a fact respectively having a variable that remains non-restricted are restricted commonly in each character string and that are restricted independently between the character strings (or defining a scope restricting a variable with the same name commonly as only in each character string (or defining the character string interval as out of the scope of the variable)); and obtaining a set of solutions that are the minimum by a whole search for finding a case that both character strings match each other by assigning any partial character string (including <null> and a whole character string) of a corresponding character string (a second character string to a variable of a first character string, a first character string to a variable of a second character string) or itself to each variable.

    20. The processing method as claimed in claim 19, comprising: instead of both character strings themselves constituted with a pattern and a head part or a fact respectively having a variable that remains non-restricted, processing the both character strings corresponding to two character strings remained after eliminating a fixed character string for the number of a characters existing commonly in a head or a tail of each character string of a pattern and a head part or a fact respectively having the variable that remains non-restricted.

    21. The processing method as claimed in claim 19, wherein: obtaining a set of solutions that are the minimum by a whole search for searching a case that both character strings match each other by assigning any partial character string (including <null> and a whole character string) of a corresponding character string or itself to each variable; conducting the whole search for searching a case that the both character strings match each other while replacing the variable included in the partial character string with a new variable that has not yet appeared in both character strings, and also assigns to the new variable in the same way recursively thereafter when a variable is included in the partial character string that is assigned to the variable.

    22. The processing method as claimed in any one of claim 19, wherein on a result of assignment to a variable, two character strings left by eliminating a fixed character for the number of a characters existing in a head and a tail of each character string from the both, are regarded as a corresponding character string to be a subject of any partial character string in corresponding character string (including <null> and the whole character string, and the number of the fixed characters existing in the head or tail of the character string is reduced as the search proceeds.

    23. The processing method as claimed in claim 16, comprising: obtaining a set of solutions to be the minimum as a fixed character string or a character string including a variable; affirming that each variable included in both character strings (referred to as a first character string and a second character string) constituted with a pattern and a head part or a fact respectively having a variable that remains non-restricted is restricted commonly in each character string and also that the variable is restricted independently between the character strings (or defining a scope restricting the variable with the same name commonly as only in each character string (or defining the character string interval as out of the scope of the variable)); obtaining a set of solutions by assigning recursively the fixed character string (including the null character) or the character string including a variable to each variable; confining a variable tried to be assigned to a variable of a corresponding head or tail of own character string in which the head or the tail of the corresponding character string is the fixed character; defining an assignment value as a new variable following the fixed character or fixed character string of the head or <null> in case the fixed character is the head, and as the fixed character or fixed character string of the tail following the new variable or <null> in case the fixed character is the tail; and on a result of assigning to a variable, repeating elimination of the fixed character for the number of the characters existing commonly in the head or tail of each character string from the both.

    24. The processing method as claimed in claim 16, comprising: obtaining a set of solutions to be the minimum as a fixed character string or a character string including a variable, affirming that each variable included in both character strings (referred to as a first character string and a second character string) constituted with a pattern and a head part or a fact respectively having a variable that remains non-restricted is restricted commonly in each character string and also that the variable is restricted independently between the character strings (or defining a scope restricting the variable with the same name commonly as only in each character string (or defining the character string interval as out of the scope of the variable)); obtaining a set of solutions by assigning recursively the fixed character string (including the null character) to each variable; obtaining restriction information generated by using only a fixed character type, which is a character type from which a variable identifier or a delimiter is eliminated, in the both character strings that are acquired as a result of eliminating a common fixed character for the number of characters existing in the head and the tail of each character string by listing up from a smallest total of the character string length of the restricting value.

    25. The processing method as claimed in claim 19, comprising: on a basis of an obtained set of solutions to be the minimum as a character string including a variable, continuing search by a Horn clause generated by rewriting a variable of the Horn clause with a character string including a variable temporarily.

    26. The processing method as claimed in claim 19, comprising: on a basis of an obtained set of solutions to be the minimum as a character string including a variable, the processing method returns a set of fixed character string setups generated by assigning an element of a set of a fixed character string setups predefined as a set of the solution setups of a fact including a variable to a variable part of a character string including a variable.

    27. The processing method as claimed in claim 1, comprising, in the automatic unification process or the automatic derivation process: when conducting an automatic unification of a first pattern including a variable and a second pattern including a variable, in case that a fixed character for the number of characters existing in a head and a tail of both patterns match each other, and the same variable appears only once in each pattern, returning information indicating the existence of infinite number of solutions.

    28. A device for executing the method claimed in claim 1.

    29. A computer program for causing a computer to execute the method claimed in claim 1.

    Description

    BRIEF DESCRIPTION OF THE DRAWINGS

    [0199] FIG. 1 is a general view of the network system conducting the present invention most effectively (Embodiment 1);

    [0200] FIG. 2 is a schematic diagram showing a hardware structure of a computer implementing the present invention (Embodiment 1); and

    [0201] FIG. 3 is a schematic diagram showing an example of a screen display of a terminal implementing the present invention (Embodiment 1).

    DESCRIPTION OF EMBODIMENTS

    [0202] The present invention can be implemented by a computer in any kind (e.g., cloud server, large multi-purpose machines, desk top computers, laptops, mobile devices, machines for the exclusive use for the present invention), regardless of whether connected/unconnected with the network. Yet here an embodiment realized by a computer having a general multi task function and a window function, which is connected with the internet, is explained hereafter.

    [0203] FIG. 1 is a general view of the network system implementing the present invention most effectively. A content managing device 1 can be a publicly-known file sharing server which receives a post of the content (the rule or the fact) handled by the present invention with a user's PC 2 or a user's and manager's PC 2 and also delivers the content while controlling a sharing access right or a priority of the content supply through a determined policy. The user's PC 2 may be a computer, including mobile device, which inputs and stores the content (the rule or the fact) each user believes (or the content each user wants to consider about) expressed in the natural language in accordance with the method of the present invention, and which processes it by the method of the present invention.

    [0204] FIG. 2 is a schematic diagram showing a hardware structure of the computer implementing the present invention. This is a typical one as the structure of a computer. Features of the present invention are the content processed in a CPU 2e by using a natural law in accordance with instructions or descriptions of programs 3 and a content data 4 stored in a nonvolatile memory 2h and a manner of a dialog protocol (or a format) with the user.

    [0205] FIG. 3 is a schematic diagram showing an example of a screen display of a terminal implementing the present invention. In FIG. 3, for a question (of open question) ?$A shi na i (do not do $A, in English), the computer lists up the answers $A=sa re te i ya na ko to ha na ru be ku/1/ (what you do not like if you get done as possible/1/, in English) using the fact sa re te i ya na ko to ha na ru be ku shi na i (do not what you do not like if you get done as possible, in English) in line 1 of a stored list L that is not shown, and answers $A=i ji me wo/9/ ($A=bully/9/, in English) by using the fact i ji me wo shi na i (do not bully, in English) in line 9 of the list L.

    [0206] In such embodiment, the computer program produced via such languages as the C++ language enables a computer, including a personal computer, to conduct a variety of possible actions. For this, a method to realize a known basic operation of the computer using the natural law (such as storing and extraction to a register, a memory or a storage, a four-function calculation, and a comparison) and a general function that has already been a standard library of a development environment (which includes: assignment, comparison and copy to a variable or an n-dimensional arrangement; operation/comparison/display of the character string or the numerical value; operation of a list structure, a queue structure, a hash structure, a vector type or the like; a binary search or a sorting operation; a pattern matching operation by a regular expression; a network communication operation) are not described here in detail, for they are not an essence of the present invention (a unique structure relating to the novelty or the inventive step) and have been known to those skilled in the art. On the other hand, it is described in detail hereinafter about an operation order or a memory method (an algorithm or a data structure) for achieving the unique process of the present invention by combining those general functions. Through the explanation of the algorithm or the like and by providing the explanation of the solution for the problem mentioned above and the explanation of the drawings of the preset invention for reference to the development, a professional programmer of standard level is definitely able to use the computer to implement the method of the present invention by using a standard application program development technique (a GUI application integrated development environment or the like by the C++ language) and also is able to produce a device or a program for the method.

    [0207] The algorithm shown below is based on a standard structuring programming which, after newly defining a desired function by some language including the C language/C++ language or the like, call the function. Those skilled in the art are able to realize a processing means (a program or a calculator) corresponding to a solution of the present invention, while separating inputs, outputs or functions according to functional division of each function below (or by coding the function group as they are according to the design indicated below).

    TABLE-US-00002 .square-solid. A processing algorithm design of a knowledge list L for an inquiry P ====================================================== ======================================= A function Q1 (P: the pattern that may include a variable, L: the knowledge list) :.star-solid.Embodiment 1 of a main function in common for all the claims.star-solid. { 1. A content B of the first row (the fact or the Horn clause) of L is taken out. In case that L is null (which means that the first row cannot be taken out), false is outputted and the process is terminated. 2. The first initial value of the restriction information C of variables is regarded as null, the below-mentioned function H (P, B, C) is called and the restriction information (= the set of solutions) C that takes true (which means matched) is outputted. In case of true (matched), true (yes) is outputted (along with the row number of the matched content B). In case of false, nothing is done. 3. In case that a content B of the next row of L exists, BB is defined and the process moves to 2, if dose not exist, false (no) is outputted, when true is not outputted at all in 2, and the process is terminated. }

    TABLE-US-00003 .square-solid. The processing algorithm design of the knowledge list L for the inquiry P (a prior fixed-stringizing version) ====================================================== ======================================= A function Q2 (P: the pattern that may include variables, L: the knowledge list) :.star-solid.Embodiment 2 of a main function in common for all the claims.star-solid. {

    [0208] (Prior Fixed-Stringizing)

    [0209] 1. A fixed character string text T having {all the character strings that can be deducted only from L/set of row numbers of L applied as the basis for deducing each character string} for its each row, is obtained.

    [0210] Specifically, the text T in which the element of an output sequence (A=solution1/argument1, A=solution2/argument2, . . . ) of the above-mentioned function Q1 ($A, L) is merged for each row, is obtained.

    [0211] In case that the process lapses into an endless loop in obtaining the text T, the deduction is partially abbreviated by an endless loop detecting function using such as an explicit call management stack.

    [0212] For example, when a true-or-false check of the Horn clause is being done by the computer under certain variable restriction condition,

    [0213] whether the true-or-false of the same Horn clause is about to be checked under the same variable restriction condition or not

    [0214] is monitored by managing the call management stack having the structure (the Horn clause identifier being checked, the current variable restriction condition) as members, and

    [0215] linear search is conducted to check whether there is the same combination toward the root of the stack when calling

    [0216] to detect the endless loop.

    [0217] (The set of solutions is obtained by a method (function F) simpler than Q1 since this is only for the fixed character string)

    [0218] 2. All C in that the below function F (P, t, C) is true is outputted for every row t of the text T.

    [0219] (Output of the Final Result)

    [0220] 3. True is outputted if there is even only one C, and the false is outputted if there is no C.

    INDUSTRIAL APPLICABILITY

    [0221] The present invention is applicable to education of the predicate logic for a range from junior-high-school students (or those at around their age) to adults and also is applicable to management, exchange, and share of public knowledge and information. This application is also true for a test of the validity of sets consisting of facts (may include opinions) and rules, which can be philosophies or mindset).

    REFERENCE SIGNS LIST

    [0222] 1 Content Control Device [0223] 2 User's PC or a PC of both of User's and Manager's [0224] 3 Program of the present invention [0225] 4 Content Data (Aggregation Set of Rule or Fact)