WO2020179519A1 - 生成装置、生成方法及びプログラム - Google Patents

生成装置、生成方法及びプログラム Download PDF

Info

Publication number
WO2020179519A1
WO2020179519A1 PCT/JP2020/007211 JP2020007211W WO2020179519A1 WO 2020179519 A1 WO2020179519 A1 WO 2020179519A1 JP 2020007211 W JP2020007211 W JP 2020007211W WO 2020179519 A1 WO2020179519 A1 WO 2020179519A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
character
word
character string
sentence
Prior art date
Application number
PCT/JP2020/007211
Other languages
English (en)
French (fr)
Inventor
正彬 西野
平尾 努
永田 昌明
Original Assignee
日本電信電話株式会社
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to US17/435,002 priority Critical patent/US20220138434A1/en
Publication of WO2020179519A1 publication Critical patent/WO2020179519A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/01Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks

Definitions

  • the present invention relates to a generation device, a generation method, and a program.
  • Anagram is known as a kind of word game.
  • An anagram is to rearrange the characters included in a given sentence (or word or phrase (phrase)) to create another sentence (or another word or another phrase).
  • another sentence (or another word, another phrase, etc.) created in this way may be called an anagram.
  • “Trims cash” is an anagram of "Christmas”.
  • Non-Patent Document 1 A technique for automatically generating an anagram from a given sentence (or word, phrase, etc.) is known (Non-Patent Document 1).
  • the present invention has been made in view of the above points, and an object of the present invention is to rearrange a given character string to generate another character string in consideration of naturalness.
  • the generation device is an input means for inputting first data which is data related to a plurality of characters included in a character string to be generated, and the first data. Based on this, it is characterized by having a generation means for generating second data which is data related to the character string satisfying a predetermined constraint condition including at least a condition regarding the plausibility of the character arrangement.
  • FIG. 6 is a diagram for explaining an example of an appearance frequency vector F and a matrix X. It is a flow chart which shows an example of search processing in an embodiment of the invention.
  • a generation device 10 for rearranging a given character string to generate another character string in consideration of naturalness will be described.
  • the character string given to the generation device 10 may be, for example, a sentence, but it does not necessarily have to be a sentence.
  • the character string may be, for example, a word, a phrase, a clause, or a set of words. Alternatively, for example, one or more characters and the number of these characters may be provided to the generation device 10.
  • the character string given to the generation device 10 is a sentence, and a case where the characters included in this sentence are rearranged to generate another sentence (anagram) will be described.
  • the generation device 10 searches for a sentence (anagram) in which characters included in a given sentence are rearranged by a depth-first search algorithm, and uses a predetermined language model during the search. Evaluate the conditions regarding the naturalness of the sentence. Then, the generation device 10 according to the embodiment of the present invention efficiently generates a natural anagram by stopping the search for a sentence that does not satisfy the condition regarding naturalness (that is, by pruning).
  • the condition necessary for rearranging the given character string to generate another character string is also expressed as a "constraint condition”. Therefore, the character string (for example, an anagram) generated by the generation device 10 according to the embodiment of the present invention can be referred to as a “character string satisfying the constraint condition” or a “character string in a sequence satisfying the constraint condition”.
  • FIG. 1 is a diagram showing an example of a functional configuration of a generation device 10 according to an embodiment of the present invention.
  • the generation device 10 has an input unit 101, a matrix creation unit 102, a search processing unit 103, an output unit 104, and an end condition determination unit 105 as functional units. Have and. Further, the generation device 10 according to the embodiment of the present invention has a vocabulary storage unit 106 and a language model storage unit 107 as storage units.
  • the vocabulary storage unit 106 stores a set of words that can be used when generating an anagram.
  • the language model storage unit 107 stores a language model that outputs a value representing the naturalness of a sentence.
  • the language model is a model that takes a sentence as an input and outputs the appearance probability of a word that follows the sentence.
  • the language model is assumed to be a language model realized by RNN (Recurrent Neural Network) (hereinafter, also referred to as “RNN language model”).
  • RNN language model any of i number of words w 1, w 2, ⁇ , w i-1, the conditional probability for w i p (w i
  • w 1 , w 2 , ⁇ , w i-1 ) is expressed by the words w 1 , w 2 , ⁇ , w i-1 , It is used as a value that represents the naturalness of a sentence composed of w i (that is, a value that represents the likelihood of a sentence).
  • w 1 , w 2 , ⁇ , w i-1 ) is greater than or equal to a preset predetermined threshold, the words w 1 , w 2 , ⁇ .
  • the sentence composed of w i-1 , w i satisfies the condition regarding the naturalness of the sentence, otherwise, the words w 1 , w 2 , ..., w i-1 , w Sentences composed of i shall not satisfy the condition regarding the naturalness of the sentence.
  • i-number of words w 1, w 2, ⁇ , w i-1 the probability of occurrence of statements made in the w i p (w 1, w 2, ⁇ , w i-1, w i ) May be used as a value representing the naturalness of this sentence.
  • the words w 1 , w 2 , ⁇ ⁇ ⁇ , w i-1 , w i are equal to or greater than a predetermined threshold, the words w 1 , w 2 , ⁇ ⁇ ⁇ , w i-
  • the sentence composed of 1 and w i satisfies the condition regarding the naturalness of the sentence, and if not, the sentence composed of the words w 1 , w 2 , ..., w i-1 , w i Does not satisfy the condition regarding the naturalness of the sentence.
  • the embodiment of the present invention can use a language model other than the RNN language model.
  • Any language model that takes words, character strings, sentences, etc. as input and outputs values that represent the naturalness of these words, character strings, sentences, etc. (values that represent their plausibility).
  • Language model can be used.
  • values representing the sequence of words and character strings and the naturalness of sentences may be acquired or calculated by a rule-based method or the like.
  • the input unit 101 inputs a sentence (hereinafter also referred to as “input sentence”) as input data.
  • the input unit 101 may input, as input data, a word, a phrase, a section, a set of words, one or more characters, the number of each of these characters, and the like.
  • the input data may be data in which voice is converted to text by voice recognition technology or the like. Therefore, the input data may be data relating to a plurality of characters included in the character string (for example, anagram) generated by the generation device 10.
  • the input unit 101 may input input data from any input source.
  • the input unit 101 may input input data stored in an auxiliary storage device or the like, or may receive and input input data transmitted from another device connected via a communication network.
  • the input data input by the user may be input using an input device such as a keyboard.
  • the matrix creating unit 102 creates an appearance frequency vector F representing the appearance frequency of each character included in the input sentence. Further, the matrix creation unit 102 acquires candidate words included in the anagram from the vocabulary storage unit 106, and creates a matrix X in which the number of occurrences of each character included in these acquired words is used as a row vector.
  • the search processing unit 103 uses the appearance frequency vector F, the matrix X, and the RNN language model stored in the language model storage unit 107 to perform a natural anagram (that is, input data is A character string which is a rearranged character string and which satisfies the condition regarding the naturalness of a sentence) is searched for and generated. Note that each time an anagram is searched and generated, the process of searching and generating the anagram by the depth-first search algorithm (search process) is once interrupted, and the output unit 104 outputs the searched and generated anagram.
  • search process search process
  • the output unit 104 outputs the anagram generated by the search processing unit 103 as output data. At this time, the output unit 104 outputs the anagram as output data each time the search processing unit 103 generates the anagram. That is, the search processing unit 103 generally searches for and generates one or more anagrams, but the output unit 104 sequentially outputs the searched and generated anagrams as output data. Depending on the input data, the words stored in the vocabulary storage unit 106, and the like, the search processing unit 103 may not search and generate any anagram.
  • the output data is not limited to a sentence (anagram) as long as it is a character string obtained by rearranging the character string represented by the input data and satisfying the condition regarding the naturalness of the sentence.
  • the output data may be a word, a phrase, a section, a set of words and the arrangement order of each word, one or more characters and the number and arrangement order of these respective characters.
  • the output unit 104 may output the output data to any output destination.
  • the output unit 104 may output the output data to an auxiliary storage device or the like, may output (transmit) the output data to another device connected via a communication network, or may output (transmit) the output data to a display or the like.
  • the output data may be output (displayed) on the display device.
  • the end condition determination unit 105 determines whether or not a predetermined end condition is satisfied.
  • the search processing by the search processing unit 103 is restarted.
  • the search process ends.
  • the predetermined end condition for example, the number of output data output by the output unit 104 has reached a predetermined number, all anagrams have been searched from the character string represented by the input data, and the like. Be done.
  • FIG. 2 is a diagram showing an example of a hardware configuration of the generation device 10 according to the embodiment of the present invention.
  • the generation device 10 includes, as hardware, an input device 201, a display device 202, an external I/F 203, a RAM (Random Access Memory) 204, and a ROM ( Read Only Memory) 205, a processor 206, a communication I/F 207, and an auxiliary storage device 208.
  • an input device 201 a display device 202
  • an external I/F 203 a RAM (Random Access Memory) 204
  • ROM Read Only Memory
  • the input device 201 is, for example, a keyboard, a mouse, a touch panel, etc., and is used by the user to input various operations.
  • the display device 202 is, for example, a display or the like, and displays the processing result of the generation device 10 (for example, the generated anagram or the like).
  • the generation device 10 does not have to have at least one of the input device 201 and the display device 202.
  • the external I / F 203 is an interface with an external recording medium such as the recording medium 203a.
  • the generation device 10 can read or write the recording medium 203a via the external I/F 203.
  • the recording medium 203a includes one or more programs that realize each functional unit (for example, input unit 101, matrix creation unit 102, search processing unit 103, output unit 104, end condition determination unit 105, etc.) of the generation device 10. May be recorded.
  • the recording medium 203a includes, for example, a flexible disk, a CD (Compact Disc), a DVD (Digital Versatile Disk), an SD memory card (Secure Digital memory card), and a USB (Universal Serial Bus) memory card.
  • a flexible disk for example, a CD (Compact Disc), a DVD (Digital Versatile Disk), an SD memory card (Secure Digital memory card), and a USB (Universal Serial Bus) memory card.
  • RAM 204 is a volatile semiconductor memory that temporarily holds programs and data.
  • the ROM 205 is a non-volatile semiconductor memory that can hold programs and data even when the power is turned off.
  • the ROM 205 stores, for example, setting information regarding an OS (Operating System), setting information regarding a communication network, and the like.
  • the processor 206 is, for example, a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), or the like, and is an arithmetic device that reads programs and data from the ROM 205, the auxiliary storage device 208, and the like onto the RAM 204 and executes processing.
  • Each functional unit included in the generation device 10 is realized by reading one or more programs stored in the ROM 205, the auxiliary storage device 208, or the like onto the RAM 204 and executing the process by the processor 206.
  • the communication I / F 207 is an interface for connecting the generator 10 to the communication network.
  • One or more programs that realize the respective functional units of the generation device 10 may be acquired (downloaded) from a predetermined server or the like via the communication I/F 207.
  • the auxiliary storage device 208 is, for example, an HDD (Hard Disk Drive), an SSD (Solid State Drive), or the like, and is a non-volatile storage device that stores programs and data.
  • the programs and data stored in the auxiliary storage device 208 include, for example, an OS, an application program that realizes various functions on the OS, and one or more programs that realize each functional unit of the generation device 10.
  • each storage unit for example, the vocabulary storage unit 106, the language model storage unit 107, etc.
  • at least one storage unit among these storage units may be realized by using a storage device or the like connected to the generation device 10 via a communication network.
  • the generation device 10 according to the embodiment of the present invention can realize an anagram generation and output process described later by having the hardware configuration shown in FIG.
  • the generation device 10 according to the embodiment of the present invention is realized by one device (computer), but the present invention is not limited to this.
  • the generation device 10 in the embodiment of the present invention may be realized by a plurality of devices (computers). Further, one device (computer) may include a plurality of processors 206 and a plurality of memories (RAM 204, ROM 205, auxiliary storage device 208, etc.).
  • FIG. 3 is a flowchart showing an example of anagram generation and output processing according to the embodiment of the present invention.
  • the input unit 101 inputs an input sentence as input data (step S101).
  • the matrix creation unit 102 creates the occurrence count vector F and the matrix X (step S102). Details of the process of creating the appearance frequency vector F and the matrix X will be described later.
  • the search processing unit 103 uses the occurrence count vector F, the matrix X, and the RNN language model stored in the language model storage unit 107 to generate an analog that satisfies the constraint condition by a depth-first search algorithm.
  • Search and generate step S104.
  • the search process is executed by calling the function SEARCH (F, X, S) that takes the occurrence number vector F, the matrix X, and the sentence S as arguments. The details of the search process will be described later.
  • the search process is interrupted once (step S315 described later).
  • the output unit 104 outputs, as output data, the anagram (that is, the sentence S) generated by the search processing unit 103 to the display device 202 such as a display (step S105).
  • the anagram is sequentially displayed on the display device 202. Note that the anagram (S) that satisfies the constraint is obtained as a solution for the search process.
  • the end condition determination unit 105 determines whether or not a predetermined end condition is satisfied (step S106).
  • step S106 When it is determined in step S106 that the predetermined termination condition is satisfied, the generation device 10 terminates the anagram generation and output processing.
  • step S107 the search processing unit 103 restarts execution of the search processing. That is, the search processing unit 103 restarts the execution of the search processing that has been interrupted due to the search and generation of the anagram satisfying the constraint.
  • the execution of the search process is restarted from the process subsequent to the position where the search process was interrupted (step S315 described later).
  • each time an anagram satisfying the constraint condition is searched and generated in the search processing the anagram is sequentially output as output data and the search processing is continued (). Determine whether to restart).
  • FIG. 4 is a flowchart showing an example of the appearance frequency vector and matrix creation processing according to the embodiment of the present invention.
  • the matrix creation unit 102 creates an appearance count vector F representing the appearance count of each character included in the input sentence (step S201).
  • the number of appearances may be referred to as “appearance frequency” or simply “frequency”.
  • FIG. 5 shows an appearance frequency vector F when the input sentence is “Christmas”.
  • the character “c” appears once in the input sentence
  • the character “h” appears once in the input sentence
  • the character “r” appears 1 times in the input sentence.
  • the character "i” appears once in the input sentence
  • the character "s” appears twice in the input sentence
  • the character "t” appears once in the input sentence
  • the character "m” is entered
  • the number of appearances in the sentence is one, and the number of appearances of the character “a” in the input sentence is one.
  • the appearance number vector F (1, 1, 1, 1, 1, 1, 2, 1, 1) shown in FIG. 5 can be obtained.
  • the first dimension is the letter “a”
  • the second dimension is the letter “c”
  • the third dimension is the letter “h”
  • the fourth dimension is the letter “i”
  • the fifth dimension is the letter “i”.
  • the eye corresponds to the letter “m”
  • the sixth dimension corresponds to the letter “r”
  • the seventh dimension corresponds to the letter “s”
  • the eighth dimension corresponds to the letter “t”.
  • the appearance frequency vector F is represented by a vector in which the number of different character types in the input sentence is the number of dimensions and each element is the number of appearances of the corresponding character in the input sentence.
  • the matrix creation unit 102 lexically stores a word that is composed of characters included in the input sentence and the number of occurrences of each character constituting the word is equal to or less than the number of appearances of the character in the input sentence. Obtained from unit 106 (step S202). For example, if the input sentence is "Christmas”, then at least one of the letters "c", "h”, “r”, “i”, “s”, “t”, “m” and "a” A word composed of characters whose appearance count of each character constituting the word is equal to or less than the appearance count of the character in the input sentence is acquired. Examples of such words include “trims”, “a”, “cash”, “shirts”, “has” and the like. Hereinafter, as an example, the description will be continued assuming that the words “trims”, “a”, “cash”, “shirts”, and “has” have been acquired.
  • the matrix creation unit 102 creates a matrix X having a row vector of the number of appearances of each character in each word acquired in the above step S202 (step S203).
  • the number of dimensions of each row vector is the same as the appearance frequency vector F, and the correspondence between each element and each character is also the same as the appearance frequency vector F.
  • the value (number of occurrences) of the element corresponding to the character not included in the word is set to "0".
  • the row vector of this word is (0, 0, 0, 1, 1, 1, 1, 1).
  • the row vector of this word is (1, 0, 0, 0, 0, 0, 0).
  • the row vector of the word “cash” is (1, 1, 1, 0, 0, 0, 1, 0)
  • the row vector of the word “shirts” is (0, 0, 1, 1, 0,
  • the row vector of the word "has” is (1, 0, 1, 0, 0, 0, 1, 0).
  • the row vector of the word “trims”, the row vector of the word “a”, the row vector of the word “cash”, the row vector of the word “shirts”, and the word “has” are arranged in order from the top. Although the row vectors of are arranged respectively, this order may be any order.
  • the matrix X is composed of a row vector in which the word candidates constituting the anagram are each line and the number of occurrences of each character included in these word candidates is each element.
  • FIG. 6 is a flowchart showing an example of search processing in the embodiment of the present invention.
  • the search process is executed by calling the function SEARCH(F, X, S) having the appearance frequency vector F, the matrix X, and the sentence S as arguments.
  • the search processing unit 103 determines whether the number of columns of the matrix X is 0 (step S301). In step S311 described later, the column corresponding to the character that has already been used in the sentence S and cannot be used any more is deleted from the matrix X.
  • the search processing unit 103 When it is determined in step S301 that the number of columns of the matrix X is not 0, the search processing unit 103 initializes the set M to an empty set (step S302).
  • the set M is a cache for preventing SEARCH(F, X, S) with the same statement S as an argument from being called multiple times.
  • the search processing unit 103 is a column c corresponding to an element having a value of 1 or more in the occurrence count vector F (that is, an element having a character appearance count of 1 or more), and is still selected in step S304 described later. It is determined whether or not the column c that has not been processed exists in the matrix X (step S303).
  • step S303 When it is determined in step S303 that the corresponding column c is not in the matrix X, the search processing unit 103 ends the search processing. In this case, the generation device 10 executes the next process at the position of the calling source of the search process (either step S104, step S107, or step S312 described later).
  • step S303 when it is determined in step S303 that there is a corresponding column c, the search processing unit 103 is a column c corresponding to an element having a value of 1 or more in the occurrence count vector F and has not yet been selected. c is selected from the matrix X (step S304).
  • a certain column c selected in this step will be referred to as a “selected column c”.
  • the search processing unit 103 determines whether or not the selection column c has an element having a value of 1 or more in the selection column c and corresponding to the row r that has not yet been selected in step S306 described later. (Step S305).
  • step S305 If it is determined in step S305 that the corresponding element is not in the selection column c, the search processing unit 103 returns to step S303. As a result, in step S303, it is determined whether or not there is a column c in the matrix X that corresponds to an element having a value of 1 or more in the occurrence number vector F and has not yet been selected.
  • the search processing unit 103 is the row r corresponding to the element having a value of 1 or more in the selection column c and is still selected.
  • a row r that does not exist is selected from the matrix X, and a word w r corresponding to the selected row r is selected (step S306).
  • a certain row r selected in this step is referred to as a “selected row r”
  • a word w r corresponding to this selected row r is referred to as a “selected word w r ”.
  • the selected word w r may be selected in the vocabulary storage unit 106.
  • the search processing unit 103 determines whether or not the selected word w r satisfies all of the following constraint conditions 1 to 3 (step S307).
  • the following constraint condition 1 corresponds to the condition regarding the naturalness of the sentence.
  • the constraint condition 2 is a condition for searching and generating an anagram
  • the constraint condition 3 is a condition for efficiently performing the search.
  • Constraint 1 After outputting the conditional probability p (w r
  • Constraint 2 Whether the number of occurrences of each character included in the selected word w r is equal to or less than the value of the element corresponding to the character in the occurrence frequency vector F. The number of occurrences of all characters included in the selected word w r is , If the occurrence frequency vector F is less than or equal to the values of the elements corresponding to all these characters, the constraint condition 2 is satisfied, and if not, the constraint condition 2 is not satisfied.
  • Constraints 3 If the selected word w r is set M in included whether or not or selected word w r is not included in the set M satisfies the constraints 3, otherwise do not meet the constraints 3.
  • step S307 If it is determined in step S307 that at least one of the constraint conditions 1 to 3 is not satisfied, the search processing unit 103 returns to step S305.
  • step S305 it is determined whether or not there is an element in the selection column c whose value is 1 or more and corresponds to the row r which has not been selected yet. In this way, when at least one of the constraints 1 to 3 is not satisfied, the depth-first search algorithm is used for pruning, and the anagram can be efficiently searched and generated. Become.
  • step S307 when it is determined in step S307 that all the constraint conditions 1 to 3 are satisfied, the search processing unit 103 creates a sentence S′ in which the selected word w r is added to the end of the sentence S (step S308). ).
  • the search processing unit 103 adds the selected word w r to the set M (step S309).
  • the search processing unit 103 deletes the selected row r from the matrix X, and subtracts the number of occurrences of each character included in the selected word w r from the element of the character of the occurrence number vector F (step S310). ..
  • the search processing unit 103 determines that the third-dimensional element, the fourth-dimensional element, and the sixth-dimensional element among the elements of the appearance frequency vector F illustrated in FIG. 1 is subtracted from each of the element and the 8th dimension element, and 2 is subtracted from the 7th dimension element.
  • the matrix X after the selected row r is deleted in this step is referred to as “matrix X′”, and the appearance frequency vector F after subtraction is referred to as “appearance vector F′”.
  • the search processing unit 103 queues X'a column c'corresponding to an element having a value of 0 in the occurrence count vector F'and a row r'corresponding to an element having a value of 1 or more in this column c'. From (step S311). As a result, the column c'corresponding to the character that cannot be used as a result of adding the selected word w r to the sentence S and the row r'corresponding to the word containing the character are deleted from the matrix X'. ..
  • the matrix X'after the deletion will be referred to as "matrix X".
  • the search processing unit 103 executes the following (1) to (3) as backtrack processing after the search processing executed in step S312 is completed (step S313).
  • backtracking (or backtracking) in the depth-first search algorithm is performed.
  • step S301 when it is determined in step S301 that the number of columns in the matrix X is 0, the search processing unit 103 outputs S to a memory, a file, or the like (step S314). That is, the search processing unit 103 outputs S as a return value of the function SEARCH(F, X, S).
  • the S output here is the solution of the search process (more accurately, one of the solutions), and is output by the output unit 104 in step S105.
  • the search processing unit 103 interrupts the execution of the search processing (step S315). Then, the generation device 10 proceeds to the process of step S105 described above.
  • the search process unit 103 has information necessary for restarting (for example, the current occurrence number vector F, the matrix X, the sentence S, and the restart position of the search process). Etc.) is stored in the memory or the like and then the execution of the search process is interrupted.
  • ⁇ Summary> As described above, in the generation device 10 according to the embodiment of the present invention, another character string satisfying the constraint condition (for example, a natural anagram as a sentence) is generated by the depth-first search algorithm using the given character string. It becomes possible to generate. Further, at this time, in the generator 10 according to the embodiment of the present invention, when the words constituting the other character strings do not satisfy the constraint condition, the depth-first search algorithm is pruned for efficiency. It is possible to generate another character string that satisfies the constraint condition.
  • the constraint condition for example, a natural anagram as a sentence
  • anagram (particularly including one anagram that satisfies the constraint condition) may be searched and generated as a solution.
  • the generation device 10 may terminate the search process when a preset number of anagrams are searched and generated as a solution.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Algebra (AREA)
  • Evolutionary Computation (AREA)
  • Probability & Statistics with Applications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

生成対象の文字列に含まれる複数の文字に関するデータである第1のデータを入力する入力手段と、前記第1のデータに基づいて、文字の並びの尤もらしさに関する条件が少なくとも含まれる所定の制約条件を満たす前記文字列に関するデータである第2のデータを生成する生成手段と、を有することを特徴とする。

Description

生成装置、生成方法及びプログラム
 本発明は、生成装置、生成方法及びプログラムに関する。
 言葉遊びの一種としてアナグラムが知られている。アナグラムとは、与えられた文(又は、単語やフレーズ(句)等)に含まれる文字を並び替えて、別の文(又は、別の単語や別のフレーズ等)を作成することである。また、このように作成された別の文(又は、別の単語や別のフレーズ等)自体をアナグラムと言うこともある。例えば、「Trims cash」は「Christmas」のアナグラムである。
 与えられた文(又は、単語やフレーズ等)からアナグラムを自動的に生成する技術が知られている(非特許文献1)。
"Internet anagram server", [online], <URL: https://wordsmith.org/anagram/>
 しかしながら、アナグラムを生成する従来技術では、生成された文字列(アナグラム)の自然さを考慮するのが困難であった。すなわち、従来技術では、例えば、与えられた文字列に含まれる全ての文字を使った他の文字列を生成することはできるものの、人間が読んだ場合に意味がわからない文字列が生成されてしまうことがあった。
 本発明は、上記の点に鑑みてなされたもので、与えられた文字列を並び替えて、自然さを考慮した他の文字列を生成することを目的とする。
 上記目的を達成するため、本発明の実施の形態における生成装置は、生成対象の文字列に含まれる複数の文字に関するデータである第1のデータを入力する入力手段と、前記第1のデータに基づいて、文字の並びの尤もらしさに関する条件が少なくとも含まれる所定の制約条件を満たす前記文字列に関するデータである第2のデータを生成する生成手段と、を有することを特徴とする。
 与えられた文字列を並び替えて、自然さを考慮した他の文字列を生成することができる。
本発明の実施の形態における生成装置の機能構成の一例を示す図である。 本発明の実施の形態における生成装置のハードウェア構成の一例を示す図である。 本発明の実施の形態におけるアナグラム生成及び出力処理の一例を示すフローチャートである。 本発明の実施の形態における出現回数ベクトル及び行列の作成処理の一例を示すフローチャートである。 出現回数ベクトルF及び行列Xの一例を説明するための図である。 本発明の実施の形態における探索処理の一例を示すフローチャートである。
 以下、本発明の実施の形態について説明する。本発明の実施の形態では、与えられた文字列を並び替えて、自然さを考慮した他の文字列を生成する生成装置10について説明する。
 ここで、生成装置10に与えられる文字列としては、例えば文が挙げられるが、必ずしも文でなくてもよい。文字列としては、例えば、単語やフレーズ(句)、節であってもよいし、単語の集合であってもよい。又は、例えば、1つ以上の文字とこれら各文字の個数とが生成装置10に与えられてもよい。以降では、一例として、生成装置10に与えられる文字列は文であるものとし、この文に含まれる文字を並び替えて他の文(アナグラム)を生成する場合について説明する。
 本発明の実施の形態における生成装置10は、与えられた文に含まれる文字を並び替えた文(アナグラム)を深さ優先探索アルゴリズムにより探索しつつ、探索の途中で所定の言語モデルを用いて文の自然さに関する条件を評価する。そして、本発明の実施の形態における生成装置10は、自然さに関する条件を満たさない文の探索を打ち切ることで(つまり、枝刈りを行うことで)、効率的に自然なアナグラムを生成する。
 なお、上記の文の自然さに関する条件も含めて、与えられた文字列を並び替えて他の文字列を生成するために必要な条件を「制約条件」とも表す。したがって、本発明の実施の形態における生成装置10が生成する文字列(例えば、アナグラム)は、「制約条件を満たす文字列」又は「制約条件を満たす並びの文字列」等ということができる。
 <生成装置10の機能構成>
 まず、本発明の実施の形態における生成装置10の機能構成について、図1を参照しながら説明する。図1は、本発明の実施の形態における生成装置10の機能構成の一例を示す図である。
 図1に示すように、本発明の実施の形態における生成装置10は、機能部として、入力部101と、行列作成部102と、探索処理部103と、出力部104と、終了条件判定部105とを有する。また、本発明の実施の形態における生成装置10は、記憶部として、語彙記憶部106と、言語モデル記憶部107とを有する。
 語彙記憶部106は、アナグラムを生成する際に利用できる単語の集合を記憶している。
 言語モデル記憶部107は、文の自然さを表す値を出力する言語モデルを記憶している。言語モデルとは、文を入力として、その文の次に来る単語の出現確率を出力するモデルのことである。
 本発明の実施の形態では、言語モデルは、RNN(Recurrent Neural Network)で実現された言語モデル(以降、「RNN言語モデル」とも表す。)であるものとする。RNN言語モデルでは、任意のi個の単語w1, w2, ・・・, wi-1, wiに対する条件付き確率p(wi|w1, w2, ・・・, wi-1)を出力する。本発明の実施の形態では、この条件付き確率p(wi|w1, w2, ・・・, wi-1)を、単語w1, w2, ・・・, wi-1, wiで構成される文の自然さを表す値(つまり、文の尤もらしさを表す値)として用いる。このとき、条件付き確率p(wi|w1, w2, ・・・, wi-1)が、予め設定された所定の閾値以上である場合には、単語w1, w2, ・・・, wi-1, wiで構成される文は文の自然さに関する条件を満たすものとし、そうでない場合には、単語w1, w2, ・・・, wi-1, wiで構成される文は文の自然さに関する条件を満たさないものとする。
 なお、i個の単語w1, w2, ・・・, wi-1, wiで構成される文の出現確率p(w1, w2, ・・・, wi-1, wi)を、この文の自然さを表す値として用いてもよい。この出現確率p(w1, w2, ・・・, wi-1, wi)は、p(w1, w2, ・・・, wi-1, wi)=p(w1)×p(w2|w1)×・・・×p(wi|w1, w2, ・・・, wi-1)と計算することができる。この場合、出現確率p(w1, w2, ・・・, wi-1, wi)が所定の閾値以上である場合には、単語w1, w2, ・・・, wi-1, wiで構成される文は文の自然さに関する条件を満たすものとし、そうでない場合には、単語w1, w2, ・・・, wi-1, wiで構成される文は文の自然さに関する条件を満たさないものとする。
 ただし、本発明の実施の形態は、RNN言語モデル以外の言語モデルを用いることも可能である。単語や文字列、文等を入力として、これらの単語や文字列の並び、文自体等に対してその自然さを表す値(その尤もらしさを表す値)を出力する言語モデルであれば、任意の言語モデルを用いることができる。また、言語モデル以外にも、ルールベースの手法等によって、単語や文字列の並び、文の自然さを表す値が取得又は算出されてもよい。
 入力部101は、入力データとして、文(以降、「入力文」とも表す。)を入力する。上述したように、入力部101は、入力データとして、単語や句、節、単語の集合、1つ以上の文字とこれら各文字の個数等が入力されてもよい。また、入力データは、音声認識技術等によって音声がテキスト化されたデータであってもよい。したがって、入力データは、生成装置10が生成する文字列(例えば、アナグラム)に含まれる複数の文字に関するデータであればよい。
 なお、入力部101は、任意の入力元から入力データを入力すればよい。例えば、入力部101は、補助記憶装置等に記憶されている入力データを入力してもよいし、通信ネットワークを介して接続された他の装置から送信された入力データを受信及び入力してもよいし、キーボード等の入力装置を用いてユーザにより入力された入力データを入力してもよい。
 行列作成部102は、入力文に含まれる各文字の出現回数を表す出現回数ベクトルFを作成する。また、行列作成部102は、アナグラムに含まれる候補となる単語を語彙記憶部106から取得し、これら取得した単語に含まれる各文字の出現回数を行ベクトルとした行列Xを作成する。
 探索処理部103は、出現回数ベクトルFと、行列Xと、言語モデル記憶部107に記憶されているRNN言語モデルとを用いて、深さ優先探索アルゴリズムにより、自然なアナグラム(つまり、入力データが表す文字列を並び替えた文字列であって、かつ、文の自然さに関する条件を満たす文字列)を探索及び生成する。なお、アナグラムが探索及び生成される度に、深さ優先探索アルゴリズムによってアナグラムを探索及び生成する処理(探索処理)は一度中断され、出力部104により、探索及び生成されたアナグラムが出力される。
 出力部104は、出力データとして、探索処理部103により生成されたアナグラムを出力する。このとき、出力部104は、探索処理部103によりアナグラムが生成される度に、当該アナグラムを出力データとして出力する。すなわち、探索処理部103では一般に1つ以上のアナグラムが探索及び生成されるが、出力部104は、これら探索及び生成されたアナグラムを逐次的に出力データとして出力する。なお、入力データや語彙記憶部106に記憶されている単語等によっては、探索処理部103でアナグラムが1つも探索及び生成されないことも有り得る。
 出力データは、入力データが表す文字列を並び替えた文字列であって、かつ、文の自然さに関する条件を満たす文字列であれば、文(アナグラム)に限られない。例えば、出力データとして、単語や句、節、単語の集合と各単語の並び順、1つ以上の文字とこれら各文字の個数及び並び順等であってもよい。
 なお、出力部104は、任意の出力先に出力データを出力すればよい。例えば、出力部104は、補助記憶装置等に出力データを出力してもよいし、通信ネットワークを介して接続された他の装置に出力データを出力(送信)してもよいし、ディスプレイ等の表示装置に出力データを出力(表示)してもよい。
 終了条件判定部105は、出力部104により出力データが出力された場合に、所定の終了条件を満たすか否かを判定する。終了条件判定部105により所定の終了条件を満たさないと判定された場合は、探索処理部103による探索処理が再開される。一方で、所定の終了条件を満たすと判定された場合は、探索処理は終了となる。ここで、所定の終了条件としては、例えば、出力部104により出力された出力データ数が所定の個数となったこと、入力データが表す文字列から全てのアナグラムが探索されたこと、等が挙げられる。
 <生成装置10のハードウェア構成>
 次に、本発明の実施の形態における生成装置10のハードウェア構成について、図2を参照しながら説明する。図2は、本発明の実施の形態における生成装置10のハードウェア構成の一例を示す図である。
 図2に示すように、本発明の実施の形態における生成装置10は、ハードウェアとして、入力装置201と、表示装置202と、外部I/F203と、RAM(Random Access Memory)204と、ROM(Read Only Memory)205と、プロセッサ206と、通信I/F207と、補助記憶装置208とを有する。これら各ハードウェアは、それぞれがバス209を介して通信可能に接続されている。
 入力装置201は、例えばキーボードやマウス、タッチパネル等であり、ユーザが各種操作を入力するのに用いられる。表示装置202は、例えばディスプレイ等であり、生成装置10の処理結果(例えば、生成されたアナグラム等)を表示する。なお、生成装置10は、入力装置201及び表示装置202の少なくとも一方を有していなくてもよい。
 外部I/F203は、記録媒体203a等の外部記録媒体とのインタフェースである。生成装置10は、外部I/F203を介して、記録媒体203aの読み取りや書き込み等を行うことができる。記録媒体203aには、生成装置10が有する各機能部(例えば、入力部101、行列作成部102、探索処理部103、出力部104及び終了条件判定部105等)を実現する1以上のプログラム等が記録されていてもよい。
 記録媒体203aには、例えば、フレキシブルディスク、CD(Compact Disc)、DVD(Digital Versatile Disk)、SDメモリカード(Secure Digital memory card)、USB(Universal Serial Bus)メモリカード等がある。
 RAM204は、プログラムやデータを一時保持する揮発性の半導体メモリである。ROM205は、電源を切ってもプログラムやデータを保持することができる不揮発性の半導体メモリである。ROM205には、例えば、OS(Operating System)に関する設定情報や通信ネットワークに関する設定情報等が格納されている。
 プロセッサ206は、例えばCPU(Central Processing Unit)やGPU(Graphics Processing Unit)等であり、ROM205や補助記憶装置208等からプログラムやデータをRAM204上に読み出して処理を実行する演算装置である。生成装置10が有する各機能部は、ROM205や補助記憶装置208等に格納されている1以上のプログラムをRAM204上に読み出してプロセッサ206が処理を実行することで実現される。
 通信I/F207は、生成装置10を通信ネットワークに接続するためのインタフェースである。生成装置10が有する各機能部を実現する1以上のプログラムは、通信I/F207を介して、所定のサーバ等から取得(ダウンロード)されてもよい。
 補助記憶装置208は、例えばHDD(Hard Disk Drive)やSSD(Solid State Drive)等であり、プログラムやデータを格納している不揮発性の記憶装置である。補助記憶装置208に格納されているプログラムやデータには、例えば、OS、当該OS上で各種機能を実現するアプリケーションプログラム、生成装置10が有する各機能部を実現する1以上のプログラム等がある。また、生成装置10が有する各記憶部(例えば、語彙記憶部106や言語モデル記憶部107等)は、例えば補助記憶装置208を用いて実現可能である。ただし、これら各記憶部のうちの少なくとも1つの記憶部が、生成装置10と通信ネットワークを介して接続される記憶装置等を用いて実現されていてもよい。
 本発明の実施の形態における生成装置10は、図2に示すハードウェア構成を有することにより、後述するアナグラム生成及び出力処理を実現することができる。なお、図2に示す例では、本発明の実施の形態における生成装置10が1台の装置(コンピュータ)で実現されている場合を示したが、これに限られない。本発明の実施の形態における生成装置10は、複数台の装置(コンピュータ)で実現されていてもよい。また、1台の装置(コンピュータ)には、複数のプロセッサ206や複数のメモリ(RAM204やROM205、補助記憶装置208等)が含まれていてもよい。
 <アナグラム生成及び出力処理>
 次に、本発明の実施の形態における生成装置10がアナグラムを生成及び出力する処理について、図3を参照しながら説明する。図3は、本発明の実施の形態におけるアナグラム生成及び出力処理の一例を示すフローチャートである。
 まず、入力部101は、入力データとして、入力文を入力する(ステップS101)。
 次に、行列作成部102は、出現回数ベクトルF及び行列Xを作成する(ステップS102)。なお、出現回数ベクトルF及び行列Xの作成処理の詳細については後述する。
 次に、探索処理部103は、出力部104により出力データとして出力される文Sを空文(例えば、S=“”)に初期化する(ステップS103)。後述する探索処理において、Sに対して単語が追加されることで、出力データとして出力される文(つまり、例えばアナグラム)が生成される。
 次に、探索処理部103は、出現回数ベクトルFと、行列Xと、言語モデル記憶部107に記憶されているRNN言語モデルとを用いて、深さ優先探索アルゴリズムにより、制約条件を満たすアナグラムを探索及び生成する(ステップS104)。ここで、探索処理は、出現回数ベクトルFと行列Xと文Sとを引数とする関数SEARCH(F, X, S)が呼び出されることで実行されるものとする。なお、探索処理の詳細については後述する。
 探索処理で制約条件を満たすアナグラムが探索及び生成された場合、探索処理は一度中断される(後述するステップS315)。そして、出力部104は、出力データとして、探索処理部103により生成されたアナグラム(つまり、文S)を、例えばディスプレイ等の表示装置202に出力する(ステップS105)。これにより、探索処理で制約条件を満たすアナグラムが探索及び生成される度に、逐次的に、当該アナグラムが表示装置202に表示される。なお、制約条件を満たすアナグラム(S)は、探索処理の解として得られる。
 次に、終了条件判定部105は、所定の終了条件を満たすか否かを判定する(ステップS106)。
 ステップS106で所定の終了条件を満たすと判定された場合、生成装置10は、アナグラム生成及び出力処理を終了する。
 一方で、ステップS106で所定の終了条件を満たさないと判定された場合、探索処理部103は、探索処理の実行を再開する(ステップS107)。すなわち、探索処理部103は、制約条件を満たすアナグラムが探索及び生成されたことによって中断されていた探索処理の実行を再開する。なお、探索処理の実行を再開する際には、探索処理を中断した位置(後述するステップS315)の次の処理から当該探索処理の実行を再開する。
 このように、図3に示すアナグラム生成及び出力処理では、探索処理で制約条件を満たすアナグラムが探索及び生成される度に、逐次的に、当該アナグラムを出力データとして出力し、探索処理を継続(再開)するか否かを判定する。ただし、必ずしも逐次的に出力データを出力する必要はなく、例えば、探索処理で制約条件を満たす全てのアナグラムを探索及び生成した後、これら生成されたアナグラムを出力データとして出力してもよい。
  《出現回数ベクトルF及び行列Fの作成処理》
 次に、上記のステップS102における出現回数ベクトルF及び行列Xを作成する処理について、図4を参照しながら説明する。図4は、本発明の実施の形態における出現回数ベクトル及び行列の作成処理の一例を示すフローチャートである。
 まず、行列作成部102は、入力文に含まれる各文字の出現回数を表す出現回数ベクトルFを作成する(ステップS201)。なお、出現回数は、「出現頻度」又は単に「頻度」等と称されてもよい。
 ここで、一例として、入力文が「Christmas」である場合の出現回数ベクトルFを図5に示す。入力文が「Christmas」である場合、文字「c」の入力文中における出現回数は1回、文字「h」の入力文中における出現回数は1回、文字「r」の入力文中における出現回数は1回、文字「i」の入力文中における出現回数は1回、文字「s」の入力文中における出現回数は2回、文字「t」の入力文中における出現回数は1回、文字「m」の入力文中における出現回数は1回、文字「a」の入力文中における出現回数は1回である。
 したがって、例えば、アルファベット順に各文字の出現回数を並べることで、図5に示す出現回数ベクトルF=(1, 1, 1, 1, 1, 1, 2, 1)が得られる。なお、図5に示す出現回数ベクトルFでは、1次元目が文字「a」、2次元目が文字「c」、3次元目が文字「h」、4次元目が文字「i」、5次元目が文字「m」、6次元目が文字「r」、7次元目が文字「s」、8次元目が文字「t」にそれぞれ対応している。
 このように、出現回数ベクトルFは、入力文中の異なる文字の種類数を次元数、各要素を対応する文字の入力文中における出現回数とするベクトルで表される。
 次に、行列作成部102は、入力文に含まれる文字で構成される単語であって、単語を構成する各文字の出現回数が、入力文中の当該文字の出現回数以下である単語を語彙記憶部106から取得する(ステップS202)。例えば、入力文が「Christmas」である場合、文字「c」、「h」、「r」、「i」、「s」、「t」、「m」及び「a」のうちの少なくとも1つの文字で構成される単語であって、当該単語を構成する各文字の出現回数が、入力文中の当該文字の出現回数以下である単語が取得される。このような単語としては、例えば、「trims」、「a」、「cash」、「shirts」、「has」等が挙げられる。以降では、一例として、単語「trims」、「a」、「cash」、「shirts」及び「has」が取得されたものとして説明を続ける。
 次に、行列作成部102は、上記のステップS202で取得した各単語中の各文字の出現回数を行ベクトルとした行列Xを作成する(ステップS203)。このとき、各行ベクトルの次元数は出現回数ベクトルFと同一とし、かつ、各要素と各文字との対応関係も出現回数ベクトルFと同一とする。なお、単語中に含まれない文字に対応する要素の値(出現回数)は「0」とする。
 例えば、単語「trims」の場合、この単語の行ベクトルは(0, 0, 0, 1, 1, 1, 1, 1)となる。同様に、例えば、単語「a」の場合、この単語の行ベクトルは(1, 0, 0, 0, 0, 0, 0, 0)となる。以降も同様に、単語「cash」の行ベクトルは(1, 1, 1, 0, 0, 0, 1, 0)、単語「shirts」の行ベクトルは(0, 0, 1, 1, 0, 1, 2, 1)、単語「has」の行ベクトルは(1, 0, 1, 0, 0, 0, 1, 0)となる。これにより、図5に示す行列Xが作成される。なお、図5に示す行列Xでは、上から順に、単語「trims」の行ベクトル、単語「a」の行ベクトル、単語「cash」の行ベクトル、単語「shirts」の行ベクトル及び単語「has」の行ベクトルをそれぞれ並べたが、この順は任意の順でよい。
 このように、行列Xは、アナグラムを構成する単語の候補をそれぞれ各行とし、これら単語の候補に含まれる各文字の出現回数を各要素とする行ベクトルで構成される。
  《探索処理》
 次に、上記のステップS104及びステップS107における探索処理について、図6を参照しながら説明する。図6は、本発明の実施の形態における探索処理の一例を示すフローチャートである。なお、探索処理は、出現回数ベクトルFと行列Xと文Sとを引数とする関数SEARCH(F, X, S)が呼び出されることで実行される。
 まず、探索処理部103は、行列Xの列の数が0であるか否かを判定する(ステップS301)。なお、後述するステップS311では、既に文Sに使用され、これ以上使用できない文字に対応する列が行列Xから削除される。
 ステップS301で行列Xの列の数が0でないと判定された場合、探索処理部103は、集合Mを空集合に初期化する(ステップS302)。集合Mは、同一の文Sを引数としたSEARCH(F, X, S)が複数回呼び出されることを防止するためのキャッシュである。
 次に、探索処理部103は、出現回数ベクトルFで値が1以上の要素(つまり、文字の出現回数が1以上である要素)に対応する列cであって、後述するステップS304で未だ選択されていない列cが行列Xにあるか否かを判定する(ステップS303)。
 ステップS303で該当の列cが行列Xにないと判定された場合、探索処理部103は、探索処理を終了する。この場合、生成装置10は、当該探索処理の呼び出し元の位置(ステップS104、ステップS107、又は後述するステップS312のいずれか)の次の処理を実行する。
 一方で、ステップS303で該当の列cがあると判定された場合、探索処理部103は、出現回数ベクトルFで値が1以上の要素に対応する列cであって、未だ選択していない列cを行列Xから選択する(ステップS304)。以降では、本ステップで選択された或る列cを「選択列c」と表す。
 次に、探索処理部103は、選択列cで値が1以上の要素であって、後述するステップS306で未だ選択されていない行rに対応する要素が選択列cにあるか否かを判定する(ステップS305)。
 ステップS305で該当の要素が選択列cにないと判定された場合、探索処理部103は、ステップS303に戻る。これにより、上記のステップS303では、出現回数ベクトルFで値が1以上の要素に対応する列cであって、未だ選択されていない列cが行列Xにあるか否かが判定される。
 一方で、ステップS305で該当の要素が選択列cにあると判定された場合、探索処理部103は、選択列cで値が1以上の要素に対応する行rであって、未だ選択していない行rを行列Xから選択すると共に、この選択した行rに対応する単語wrを選択する(ステップS306)。以降では、本ステップで選択された或る行rを「選択行r」、この選択行rに対応する単語wrを「選択単語wr」と表す。なお、選択単語wrは、語彙記憶部106が選択されればよい。
 次に、探索処理部103は、選択単語wrが以下の制約条件1~制約条件3を全て満たすか否かを判定する(ステップS307)。なお、以下の制約条件1が文の自然さに関する条件に該当する。一方で、制約条件2はアナグラムを探索及び生成するための条件、制約条件3はその探索を効率的に行うための条件である。
 制約条件1:言語モデル記憶部107に記憶されているRNN言語モデルを用いて条件付き確率p(wr|S)を出力した上で、この条件付き確率p(wr|S)が所定の閾値以上であるか否か
 条件付き確率p(wr|S)が所定の閾値以上である場合は制約条件1を満たし、そうでない場合は制約条件1を満たさない。
 制約条件2:選択単語wrに含まれる各文字の出現回数が、出現頻度ベクトルFで当該文字に対応する要素の値以下である否か
 選択単語wrに含まれる全ての文字の出現回数が、出現頻度ベクトルFでこれら全ての文字にそれぞれ対応する要素の値以下である場合は制約条件2を満たし、そうでない場合は制約条件2を満たさない。
 制約条件3:選択単語wrが集合Mに含まれていないか否か
 選択単語wrが集合Mに含まれていない場合は制約条件3を満たし、そうでない場合は制約条件3を満たさない。
 ステップS307で制約条件1~制約条件3のうちの少なくとも1つの制約条件を満たさないと判定された場合、探索処理部103は、ステップS305に戻る。これにより、上記のステップS305では、選択列cで値が1以上の要素であって、未だ選択されていない行rに対応する要素が選択列cにあるか否かが判定される。このように、制約条件1~制約条件3のうちの少なくとも1つの制約条件を満たさない場合は、深さ優先探索アルゴリズムにおける枝刈りが行われ、効率的にアナグラムを探索及び生成することが可能となる。
 一方で、ステップS307で制約条件1~制約条件3の全てを満たすと判定された場合、探索処理部103は、文Sの末尾に選択単語wrを追加した文S´を作成する(ステップS308)。
 次に、探索処理部103は、集合Mに選択単語wrを追加する(ステップS309)。
 次に、探索処理部103は、行列Xから選択行rを削除すると共に、選択単語wrに含まれる各文字の出現回数を、出現回数ベクトルFの当該文字の要素から減算する(ステップS310)。例えば、選択単語wrが「shirts」である場合、探索処理部103は、図5に示す出現回数ベクトルFの各要素のうち、3次元目の要素と4次元目の要素と6次元目の要素と8次元の要素とからそれぞれ1を減算すると共に、7次元目の要素から2を減算する。以降では、本ステップで選択行rが削除された後の行列Xを「行列X´」と表し、減算後の出現回数ベクトルFを「出現回数ベクトルF´」と表す。
 次に、探索処理部103は、出現回数ベクトルF´で値が0の要素に対応する列c´と、この列c´で値が1以上の要素に対応する行r´とを行列X´から削除する(ステップS311)。これにより、選択単語wrが文Sに追加された結果、使用できなくなった文字に対応する列c´と、当該文字が含まれる単語に対応する行r´とが行列X´から削除される。以降では、この削除後の行列X´を「行列X´´」と表す。
 次に、探索処理部103は、F=F´、X=X´´、S=S´として関数SEARCH(F, X, S)を呼び出して、探索処理を実行する(ステップS312)。すなわち、探索処理部103は、探索処理を再帰的に実行する。
 次に、探索処理部103は、上記のステップS312で実行された探索処理の終了後、バックトラック処理として以下の(1)~(3)を実行する(ステップS313)。
 (1)上記のステップS308でSに追加された選択単語wrを削除して、S´をSに戻す。
 (2)上記のステップS310で削除された選択行rと、上記のステップS311で削除された列c´及び行r´とを行列X´´に追加して、行列X´´を行列Xに戻す。
 (3)上記のステップS310で減算された値を出現回数ベクトルF´に加算して、出現回数ベクトルF´を出現回数ベクトルFに戻す。
 これにより、深さ優先探索アルゴリズムにおけるバックトラック(又は、バックトラッキング)が行われる。
 一方で、上記のステップS301で行列Xの列の数が0であると判定された場合、探索処理部103は、Sをメモリやファイル等に出力する(ステップS314)。すなわち、探索処理部103は、関数SEARCH(F, X, S)の戻り値としてSを出力する。ここで出力されたSが探索処理の解(より正確には、解の1つ)であり、上記のステップS105で出力部104により出力される。
 次に、探索処理部103は、探索処理の実行を中断する(ステップS315)。そして、生成装置10は、上記のステップS105の処理に進む。なお、上記のステップS107で探索処理の実行を再開可能とするため、探索処理部103は、再開に必要な情報(例えば、現時点の出現回数ベクトルFや行列X、文S、探索処理の再開位置等)をメモリ等に格納した上で探索処理の実行を中断する。
 <まとめ>
 以上により、本発明の実施の形態における生成装置10では、与えられた文字列を用いて、深さ優先探索アルゴリズムにより、制約条件を満たす他の文字列(例えば、文として自然なアナグラム等)を生成することが可能となる。また、このとき、本発明の実施の形態における生成装置10では、他の文字列を構成する単語が制約条件を満たさない場合には、深さ優先探索アルゴリズムの枝刈りを行うことで、効率的に制約条件を満たす他の文字列を生成することが可能となる。
 なお、本発明の実施の形態では、一例として、深さ優先探索アルゴリズムにより、制約条件を満たす全てのアナグラムを解として探索及び生成する場合について説明したが、例えば、制約条件を満たす任意の個数のアナグラム(特に、制約条件を満たす1つのアナグラムも含む)を解として探索及び生成されてもよい。この場合、生成装置10は、予め設定された個数のアナグラムが解として探索及び生成された場合に、探索処理を打ち切ればよい。
 本発明は、具体的に開示された上記の実施形態に限定されるものではなく、特許請求の範囲から逸脱することなく、種々の変形や変更が可能である。
 10    生成装置
 101   入力部
 102   行列作成部
 103   探索処理部
 104   出力部
 105   終了条件判定部
 106   語彙記憶部
 107   言語モデル記憶部

Claims (8)

  1.  生成対象の文字列に含まれる複数の文字に関するデータである第1のデータを入力する入力手段と、
     前記第1のデータに基づいて、文字の並びの尤もらしさに関する条件が少なくとも含まれる所定の制約条件を満たす前記文字列に関するデータである第2のデータを生成する生成手段と、
     を有することを特徴とする生成装置。
  2.  前記生成手段は、
     深さ優先探索アルゴリズムにより前記制約条件を満たす文字列を探索し、
     前記深さ優先アルゴリズムでは、
     前記文字列を構成する文字又は単語として、前記制約条件を満たさない文字又は単語が探索された場合、前記文字又は単語以降の文字又は単語の探索は行わない、ことを特徴とする請求項1に記載の生成装置。
  3.  前記第1のデータが表す複数の文字に含まれる各文字の出現回数に基づいて、前記複数の文字に含まれる各文字の出現回数に関するデータを第1の出現回数データとし、
     複数の単語データが記憶されている語彙記憶部を参照して、単語に含まれる各文字それぞれの出現回数が、前記第1の出現回数データが表す各文字それぞれの出現回数以下である単語の単語データを前記語彙記憶部から取得し、取得した各単語データそれぞれが表す単語に含まれる各文字の出現回数に関するデータを第2の出現回数データとして作成する手段を有し、
     前記生成手段は、
     前記第1の出現回数データと前記第2の出現回数データとを用いて、前記深さ優先探索アルゴリズムにより前記制約条件を満たす文字列を探索する、ことを特徴とする請求項2に記載の生成装置。
  4.  前記尤もらしさに関する条件は、
     所定の言語モデル又はルールベース手法によって算出される、文字の並びの尤もらしさを表す値に関する条件である、ことを特徴とする請求項1乃至3の何れか一項に記載の生成装置。
  5.  前記制約条件には、
     前記第2のデータが表す文字列を、前記第1のデータが表す複数の文字を並び替えた文字列とするための条件が含まれる、ことを特徴とする請求項1乃至4の何れか一項に記載の生成装置。
  6.  前記第1のデータが表す複数の文字は、文、単語、句、節、単語の集合、文字と該文字の個数との組、のうちの少なくとも1つである、ことを特徴とする請求項1乃至5の何れか一項に記載の生成装置。
  7.  生成対象の文字列に含まれる複数の文字に関するデータである第1のデータを入力する入力手順と、
     前記第1のデータに基づいて、文字の並びの尤もらしさに関する条件が少なくとも含まれる所定の制約条件を満たす前記文字列に関するデータである第2のデータを生成する生成手順と、
     を実行することを特徴とする生成方法。
  8.  コンピュータを、請求項1乃至6の何れか一項に記載の生成装置における各手段として機能させるためのプログラム。
PCT/JP2020/007211 2019-03-01 2020-02-21 生成装置、生成方法及びプログラム WO2020179519A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/435,002 US20220138434A1 (en) 2019-03-01 2020-02-21 Generation apparatus, generation method and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2019037605A JP7298192B2 (ja) 2019-03-01 2019-03-01 生成装置、生成方法及びプログラム
JP2019-037605 2019-03-01

Publications (1)

Publication Number Publication Date
WO2020179519A1 true WO2020179519A1 (ja) 2020-09-10

Family

ID=72264975

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/007211 WO2020179519A1 (ja) 2019-03-01 2020-02-21 生成装置、生成方法及びプログラム

Country Status (3)

Country Link
US (1) US20220138434A1 (ja)
JP (1) JP7298192B2 (ja)
WO (1) WO2020179519A1 (ja)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009059138A (ja) * 2007-08-31 2009-03-19 Seiko Instruments Inc 単語検索装置、方法及びプログラム

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10431210B1 (en) * 2018-04-16 2019-10-01 International Business Machines Corporation Implementing a whole sentence recurrent neural network language model for natural language processing

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009059138A (ja) * 2007-08-31 2009-03-19 Seiko Instruments Inc 単語検索装置、方法及びプログラム

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KEISUKE SUZUKI, SATOSHI SATO ,KAZUNORI KOMATANI: "Automatic Generation of Japanese Anagrams by Using Bunsetsu Database", THE INSTIUTE OF ELECTRONICS, INFORMATION AND COMMUNICATION ENGINEERS, 22 August 2011 (2011-08-22), pages 97 - 102, XP055737098 *
SATOSHI ONO; DAISUKE MURAYAMA; YOSUKE SAWAI; SHIGERU NAKAYAMA: "Japanese Anagram Generation Using Evolutionary Computation", SIG-KBS-B001-03, 7 October 2010 (2010-10-07), pages 17 - 22, XP009523577 *

Also Published As

Publication number Publication date
JP2020140627A (ja) 2020-09-03
US20220138434A1 (en) 2022-05-05
JP7298192B2 (ja) 2023-06-27

Similar Documents

Publication Publication Date Title
Guttag et al. Introduction to computation and programming using Python
US20120262461A1 (en) System and Method for the Normalization of Text
JP5513898B2 (ja) 共有された言語モデル
KR20210061141A (ko) 자연어 처리 방법 및 장치
US11531693B2 (en) Information processing apparatus, method and non-transitory computer readable medium
CN104951219B (zh) 一种移动终端文本输入的方法及移动终端
JP2020064624A (ja) サブワード単位の分割方法、装置及びコンピュータ読み取り可能な記憶媒体
JP2002117027A (ja) 感情情報抽出方法および感情情報抽出プログラムの記録媒体
US20220284187A1 (en) Language model based writing aid method, device and system
JP7103264B2 (ja) 生成装置、学習装置、生成方法及びプログラム
JP7230576B2 (ja) 生成装置、学習装置、生成方法及びプログラム
WO2020179519A1 (ja) 生成装置、生成方法及びプログラム
KR20210060018A (ko) 전자 장치, 문서 요약문 생성 방법 및 저장 매체
Wolohan Mastering Large Datasets with Python: Parallelize and Distribute Your Python Code
JP6689466B1 (ja) 文構造ベクトル化装置、文構造ベクトル化方法、及び文構造ベクトル化プログラム
JP2022548053A (ja) 解釈可能な再帰型マルチホップ質問回答のためのフォローアップ質問の生成
Mammadov et al. Part-of-speech tagging for azerbaijani language
US20200279024A1 (en) Non-transitory computer readable medium
JP4341077B2 (ja) 文書処理装置、文書処理方法、および、文書処理プログラム
WO2014030258A1 (ja) 形態素解析装置、テキスト分析方法、及びそのプログラム
JP6805927B2 (ja) インデックス生成プログラム、データ検索プログラム、インデックス生成装置、データ検索装置、インデックス生成方法、及びデータ検索方法
JP3961858B2 (ja) 翻字装置及びそのプログラム
WO2011118428A1 (ja) 要求獲得システム、要求獲得方法、及び要求獲得用プログラム
JP6425732B2 (ja) 文章検索システム、極性判定ルール修正システム、文章検索方法及び極性判定ルール修正方法
JP4049141B2 (ja) 文書処理装置、文書処理方法、および、文書処理プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20766466

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20766466

Country of ref document: EP

Kind code of ref document: A1