JP2011221845A - Text processing apparatus, text processing method and text processing program - Google Patents
Text processing apparatus, text processing method and text processing program Download PDFInfo
- Publication number
- JP2011221845A JP2011221845A JP2010091311A JP2010091311A JP2011221845A JP 2011221845 A JP2011221845 A JP 2011221845A JP 2010091311 A JP2010091311 A JP 2010091311A JP 2010091311 A JP2010091311 A JP 2010091311A JP 2011221845 A JP2011221845 A JP 2011221845A
- Authority
- JP
- Japan
- Prior art keywords
- node
- character
- text
- determination position
- child
- 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.)
- Granted
Links
- 238000012545 processing Methods 0.000 title claims description 121
- 238000003672 processing method Methods 0.000 title claims description 15
- 238000000034 method Methods 0.000 claims description 103
- 230000008569 process Effects 0.000 claims description 71
- 238000007906 compression Methods 0.000 abstract description 40
- 230000006835 compression Effects 0.000 abstract description 34
- 230000008859 change Effects 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 27
- 230000006870 function Effects 0.000 description 25
- 230000006837 decompression Effects 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 230000003287 optical effect Effects 0.000 description 7
- 238000010276 construction Methods 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 230000010365 information processing Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000010845 search algorithm Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Images
Landscapes
- Document Processing Apparatus (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Machine Translation (AREA)
Abstract
Description
本発明はテキストデータを処理するテキスト処理装置、テキスト処理方法、およびテキスト処理プログラムに関する。 The present invention relates to a text processing device, a text processing method, and a text processing program for processing text data.
コンピュータシステムにおいて、テキストデータを処理対象とした情報処理を行う場合がある。例えば、テキストデータを対象とした情報検索が行われる。
近年、情報通信技術の用途の拡大に伴い、処理されるテキストデータの量が増加傾向にある。そこで、テキストデータを処理対象とした情報処理を効率化するためのさまざまな技術が考えられている。例えば、小容量のメモリを用いて、高速にデータソート処理を行うデータソート処理方法が考えられている。また、指定された項目に沿ったデータ集合の分割を効率よく行うことができるデータ集合分割方法も考えられている。
In a computer system, information processing may be performed on text data as a processing target. For example, information retrieval for text data is performed.
In recent years, with the expansion of applications of information communication technology, the amount of text data to be processed tends to increase. Therefore, various techniques for improving the efficiency of information processing for processing text data have been considered. For example, a data sort processing method that performs data sort processing at high speed using a small-capacity memory is considered. In addition, a data set dividing method that can efficiently divide a data set along a designated item has been considered.
ところで、テキストデータを検索する場合、蓄積されたテキストデータの中から、検索キーワードに合致する文字列を効率的よく検出することで、処理の高速化が図れる。例えば、圧縮パターン照合技術がある。圧縮パターン照合では、テキストデータを圧縮して保存しておき、圧縮されたテキストを解凍せずにパターン照合が行われる。 By the way, when searching text data, the processing speed can be increased by efficiently detecting a character string that matches the search keyword from the stored text data. For example, there is a compression pattern matching technique. In compressed pattern matching, text data is compressed and stored, and pattern matching is performed without decompressing the compressed text.
圧縮パターン照合では、テキストデータを圧縮したまま検索できるように、入力されたテキストの中に含まれる部分文字列を、その部分文字列を一意に特定可能な符号に符号化する。テキストデータに含まれる部分文字列を符号化することで、元のテキストデータよりもデータ量を減少させることができる。 In the compression pattern matching, the partial character string included in the input text is encoded into a code that can uniquely identify the partial character string so that the text data can be searched while being compressed. By encoding the partial character string included in the text data, the data amount can be reduced as compared with the original text data.
テキストの中の特定の文字列を符号化する際、出現頻度が高い部分文字列、または長い部分文字列を符号化すれば圧縮率が向上する。このような圧縮率の向上技術としてSTVF(Suffix Tree based Variable-length-to-Fixed-length code)符号化技術が考えられている。 When a specific character string in a text is encoded, if a partial character string having a high appearance frequency or a long partial character string is encoded, the compression rate is improved. As a technique for improving the compression rate, a STVF (Suffix Tree based Variable-length-to-Fixed-length code) coding technique is considered.
STVF符号化技術では、頻度情報に基づいて刈り込んだ接尾辞木を文節木として、VF(Variable-length-to-Fixed-length code)符号化が行われる。 In the STVF encoding technique, VF (Variable-length-to-Fixed-length code) encoding is performed using a suffix tree trimmed based on frequency information as a phrase tree.
しかし、STVF符号化による文節木の作成には時間がかかるという問題がある。すなわち、STVF符号化における接尾辞木の作成には、テキストデータ全体を解析することになるため処理に時間がかかる。しかも、接尾辞木の作成は、テキストデータの量が多いほど時間が多くかかる。 However, there is a problem that it takes time to create a phrase tree by STVF encoding. That is, the creation of a suffix tree in STVF encoding takes time for processing because the entire text data is analyzed. Moreover, the creation of a suffix tree takes more time as the amount of text data increases.
本発明はこのような点に鑑みてなされたものであり、テキストデータの高圧縮率での符号化に利用可能な文節木を効率的に作成することができるテキスト処理装置、テキスト処理方法、およびテキスト処理プログラムを提供することを目的とする。 The present invention has been made in view of the above points, and is a text processing device, a text processing method, and a text processing method capable of efficiently creating a phrase tree that can be used for encoding text data at a high compression rate. An object is to provide a text processing program.
上記課題を解決するために、文字選択手段、ノード追加手段、および頻度カウント手段、を有するテキスト処理装置が提供される。文字選択手段は、テキストデータ内の文字列から順に文字を選択する。ノード追加手段は、テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対してテキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照する。そしてノード追加手段は、ルートのノードから判断位置を開始し、判断位置のノードに対して文字選択手段で選択された文字に対応する子のノードが存在する場合、該子のノードに判断位置を移動する。またノード追加手段は、判断位置のノードに対して選択された文字に対応する子のノードが存在せず、かつ判断位置のノードに付与された選択された文字の出現回数が所定の閾値に達していない場合、ルートのノードに対する選択された文字に対応する子のノードに判断位置を移動する。さらにノード追加手段は、判断位置のノードに対して選択された文字に対応する子のノードが存在せず、かつ判断位置のノードに付与された選択された文字の出現回数が所定の閾値に達している場合、判断位置のノードに対して、新たな識別子を付与した、選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに判断位置を移動する。頻度カウント手段は、文節木記憶手段を参照し、判断位置のノードに対して選択された文字に対応するノードが存在しない場合、判断位置のノードの付与された選択された文字の出現回数をカウントアップする。 In order to solve the above-described problem, a text processing apparatus having a character selection unit, a node addition unit, and a frequency count unit is provided. A character selection means selects a character in order from the character string in text data. The node adding means associates a plurality of nodes corresponding to characters that can appear in the text data in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data for each node A phrase tree memory that stores a phrase tree in which a node identifier and the number of appearances of each character that appears next when each node is determined are associated with each node. Refer to the means. Then, the node adding means starts the determination position from the root node, and when there is a child node corresponding to the character selected by the character selection means for the determination position node, the determination position is set to the child node. Moving. In addition, the node adding means has no child node corresponding to the character selected for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position has reached a predetermined threshold. If not, the determination position is moved to the child node corresponding to the selected character for the root node. Further, the node adding means has no child node corresponding to the character selected for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position has reached a predetermined threshold. If it is, the child node corresponding to the selected character to which a new identifier is assigned is added to the node at the determination position, and the determination position is moved to the added child node. The frequency counting means refers to the phrase tree storage means, and if there is no node corresponding to the character selected for the node at the judgment position, counts the number of appearances of the selected character to which the node at the judgment position is given. Up.
また、上記テキスト処理装置が実行する処理と同様の処理をコンピュータが実行するテキスト処理方法が提供される。さらに、上記テキスト処理装置が実行する処理と同様の処理をコンピュータに実行させるテキスト処理プログラムが提供される。 Also provided is a text processing method in which a computer executes a process similar to the process executed by the text processing apparatus. Furthermore, a text processing program for causing a computer to execute processing similar to the processing executed by the text processing device is provided.
上記テキスト処理装置、テキスト処理方法、およびテキスト処理プログラムによれば、テキストデータの高圧縮率での符号化に利用可能な文節木を効率的に作成することができる。 According to the above text processing device, text processing method, and text processing program, it is possible to efficiently create a phrase tree that can be used for encoding text data at a high compression rate.
以下、本実施の形態について図面を参照して説明する。
〔第1の実施の形態〕
図1は、実施の形態の概要を示す図である。テキスト処理装置1は、文字選択手段1a、ノード追加手段1b、頻度カウント手段1c、識別子出力手段1dを有する。
Hereinafter, the present embodiment will be described with reference to the drawings.
[First Embodiment]
FIG. 1 is a diagram showing an outline of the embodiment. The
また、文節木記憶手段2は、文節木2aを記憶する。文節木2aは、テキストデータ3に出現し得る文字に対応する複数のノードがルート(根)のノードの子として木構造で予め関連付けられている。また文節木2aは、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能である。さらに文節木2aの各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与されている。
The phrase tree storage means 2 stores a
図1の例では、各ノードを丸印で表し、ノードを示す丸印の中に、該当ノードの識別子が示されている。また、文節木2aは、ノード間を接続する矢印により、木構造におけるノード間の関係を示している。繋げられた2つのノードのうち、ルートのノードに近い方のノードが親のノード、ルートのノードから遠い方のノードが子のノードである。ノードを接続する矢印の横に、子のノードに対応する文字が示されている。
In the example of FIG. 1, each node is represented by a circle, and the identifier of the corresponding node is indicated in the circle indicating the node. The
ルートのノードには、例えば初期状態から、テキストデータ3に含まれ得る各文字に対応する子のノードが設けられる。図1の例では、テキストデータ3に「a,b,c,d」の4つの文字を含まれ得るものとし、識別子「0」のルートのノードには、識別子「1」〜「4」の4つの子のノードが設けられている。
The root node is provided with a child node corresponding to each character that can be included in the
文字選択手段1aは、テキストデータ3内の文字列から順に文字を選択する。図1の例では、テキストデータ3に「abcabcdabc」という文字列が含まれている。例えば文字選択手段1aは、「abcabcdabc」の左から順に文字を1文字ずつ選択する。
The
ノード追加手段1bは、文節木記憶手段2を参照する。そしてノード追加手段1bは、ルートのノードから判断位置を開始する。ノード追加手段1bは、判断位置のノードに対して文字選択手段1aで選択された文字に対応する子のノードが存在する場合、該子のノードに判断位置を移動する。
The
またノード追加手段1bは、判断位置のノードに対して選択された文字に対応する子のノードが存在しない場合、判断位置のノードに付与された選択された文字の出現回数が所定の閾値に達しているか否かを判断する。判断位置のノードに付与された選択された文字の出現回数が所定の閾値に達していない場合、ノード追加手段1bは、ルートのノードに対する選択された文字に対応する子のノードに判断位置を移動する。他方、判断位置のノードに付与された選択された文字の出現回数が所定の閾値に達している場合、ノード追加手段1bは、判断位置のノードに対して、新たな識別子を付与した、選択された文字に対応する子のノードを追加する。このときノード追加手段1bは、追加した子のノードに判断位置を移動する。
Further, the
例えば、ノード追加手段1bは、子のノードの追加を、文節木2aのノードの数が所定数に達するまで行う。換言すると、ノード追加手段1bは、ノードの数が所定数を超えると、子のノードの追加を行わないようにすることができる。
For example, the
なお、文節木2aに追加されたノードは、ルートのノードから該当ノードまで辿ったときの経路上の各ノードに対応する文字の配列で示される部分文字列(文節)に対応する。すなわち、追加したノードの識別子が、そのノードに対応する文字列を表す符号となる。
Note that the node added to the
頻度カウント手段1cは、文節木記憶手段2を参照する。そして頻度カウント手段1cは、判断位置のノードに対して選択された文字に対応するノードが存在しない場合、判断位置のノードの付与された選択された文字の出現回数をカウントアップする。例えば、頻度カウント手段1cは、判断位置のノードに付与された選択された文字の出現回数を「1」だけ増加させる。なお頻度カウント手段1cは、判断位置のノードに対して選択された文字に対応するノードが存在する場合についても、判断位置のノードの付与された選択された文字の出現回数をカウントアップするようにしてもよい。
The
また頻度カウント手段1cは、判断位置のノードに対して選択された文字に対応するノードが存在しない場合、ノード追加手段1bによる処理に先立って、出現回数をカウントアップすることができる。この場合、ノード追加手段1bは、カウントアップ後の出現回数について、閾値に達しているか否かを判断する。
The frequency counting means 1c can count up the number of appearances prior to the processing by the node adding means 1b when there is no node corresponding to the character selected for the node at the determination position. In this case, the
識別子出力手段1dは、文節木記憶手段2を参照する。そして識別子出力手段1dは、判断位置のノードに対して選択された文字に対応する子のノードが存在しない場合、判断位置のノードに付与された識別子を出力する。また識別子出力手段1dは、テキストデータ3内の文字列の最後の文字が選択されたことにより判断位置が移動されると、移動後の判断位置のノードに付与された識別子も出力するようにしてもよい。ここで、識別子出力手段1dで出力された各識別子が、テキストデータ3内の部分文字列ごとの符号となる。そして、テキストデータ3内のすべての文字列に対応して識別子出力手段1dから出力された識別子の列が、テキストデータ3を符号化した符号語列4となる。識別子出力手段1dは、例えば、符号語列4を記憶装置に格納することができる。また、識別子出力手段1dは、符号語列4を、生成された符号から順次、ネットワークを介して送出することもできる。
The
このようなテキスト処理装置1によれば、文字選択手段1aによりテキストデータ3内の文字列から順に選択される。すると、頻度カウント手段1cにより、判断位置のノードに付与された選択された文字の出現回数がカウントアップされる。
According to such a
そして、判断位置のノードに対して選択された文字に対応する子のノードが存在する場合、ノード追加手段1bにより、判断位置が、判断位置のノードの選択された文字に対応する子のノードに変更される。これにより、選択された文字に対応する子のノードが存在する限り、文節木のルートから葉に向かって判断位置のノードが遷移する。
When there is a child node corresponding to the character selected for the node at the determination position, the
また判断位置のノードに対して選択された文字に対応する子のノードが存在せず、かつ判断位置のノードに付与された選択された文字の出現回数が閾値に達した場合、ノード追加手段1bにより文節木2aへのノードの追加が行われる。すなわち、ノード追加手段1bにより、判断位置のノードに対する選択された文字に対応する子のノードが、文節木2aに追加される。この場合、ノード追加手段1bにより、判断位置が追加された子のノードに移動される。
If there is no child node corresponding to the character selected for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position reaches the threshold value, the node adding means 1b Thus, the node is added to the
また、判断位置のノードに対して選択された文字に対応する子のノードが存在せず、かつ判断位置のノードに付与された選択された文字の出現回数が閾値に達しない場合、ノード追加手段1bにより、判断位置が移動される。すなわち、ノード追加手段1bにより、文節木2aのルートのノードに対する選択された文字に対応する子のノードに、判断位置が移動される。これにより、選択された文字に対応する子のノードが存在しなければ、以後、ルートのノードに戻って、選択した文字を先頭とする部分文字列による文節木との照合が行われる。
If there is no child node corresponding to the character selected for the node at the determination position, and the number of appearances of the selected character given to the node at the determination position does not reach the threshold value, the node addition means The determination position is moved by 1b. In other words, the node addition means 1b moves the determination position to the child node corresponding to the selected character for the root node of the
さらに、判断位置のノードに対して選択された文字に対応する子のノードが存在しない場合、識別子出力手段1dにより、判断位置のノードに付与された識別子が出力される。そのため、テキストデータ3内のすべての文字が選択されることで、識別子出力手段1dからは、テキストデータ3全体を符号化した符号語列4が出力される。これにより、文節木2aの構築処理と並行してテキストデータ3を符号化することが可能となっている。
Further, when there is no child node corresponding to the character selected for the node at the determination position, the identifier output means 1d outputs the identifier assigned to the node at the determination position. For this reason, when all the characters in the
このように、テキストデータ3内の文字を選択していくことで、出現頻度が所定値以上の文字列に対応するノードで構成される文節木2aが生成される。また文節木2aを符号化辞書として利用して、テキストデータ3が符号化され、符号語列4が出力される。
Thus, by selecting characters in the
生成される文節木2aは、出現頻度が高い部分文字列に対応するノードで構成されるため、文節木2aを用いた符号化により、高圧縮率での符号化が可能である。
さらに、テキスト処理装置1による文節木2aの構築は、STVF符号化と比較すると、テキストデータ3全体からの接尾辞木の構築処理が必要ないため、短時間で行うことができる。しかも、文節木2aの構築と並行してテキストデータ3の符号化が可能であるため、テキストデータ3の符号化についても効率的に行うことができる。例えばテキスト処理装置1による符号化は、STVF符号化技術より20倍ほど高速に符号化が可能である(符号化に要する時間が20分の1)。
Since the generated
Further, the construction of the
また、テキスト処理装置1によるテキストデータ3の符号化は、STVF符号化と異なり、逐次処理が可能である。すなわち、STVF符号化を用いた場合、テキストデータ3に基づいて接尾辞木を構築後、その接尾辞木の刈り込み(頻度の高い文字列に対応するノードのみを残す処理)が行われ、文節木が生成される(1パス目の処理)。そして、STVF符号化では、生成された文節木を用いて、テキストデータ3が符号化される(2パス目の処理)。このようにSTVF符号化では、2パスのアルゴリズムであるため、1パス目の処理が完了するまで、テキストデータの符号化は開始できず、逐次処理が困難であった。
Further, the encoding of the
他方、テキスト処理装置1では、テキストデータ3の先頭から順番に文字を選択し、その文字から文節木2aの構築とテキストデータ3の符号化を実行することができる。そして、テキストデータ3内の各文字は、1回ずつ処理対象として選択すればよい。そのため、1文字ずつの逐次処理が可能となる。逐次処理が可能であるため、例えば、ネットワーク上を転送されるテキストデータ3を、通信遅延を最小限に抑えて、テキストデータ3内の部分文字列を逐次的に符号化して、生成された符号を随時転送することができる。
On the other hand, the
なお、逐次処理よりも圧縮率の向上を優先する場合、文節木2aを構築後、その文節木2aを用いてテキストデータ3の先頭の文字から順に再度選択し、符号化処理を行ってもよい。これによりテキストデータ3の圧縮率を高めることができる。
When priority is given to improving the compression ratio over sequential processing, after the
また文節木2aは、符号語列4の高速な圧縮パターン照合を実現するための有利な性質を備えている。圧縮パターン照合とは、圧縮されたテキストに対して、解凍せずにパターン照合を行う技術である。高速な圧縮パターン照合に有利な圧縮技術の性質としては、VF符号化、静的な符号化辞書、より高い圧縮率が挙げられる。文節木2aが高い圧縮率を備えていることは、前述の通りである。また、テキスト処理装置1で生成される文節木2aは、符号として用いる各ノードの識別子のビット数を固定長とすることで、VF符号化が可能となる。符号が固定長であれば、符号間の区切りが明確であり、照合すべき文字列と符号語列4とを照合する際の処理負荷が少なくて済む。また文節木2aに対するノードが所定数に達した時点で文節木2aへのノードの追加を終了することで、それ以後の文節木2aは静的な符号化辞書として利用できる。
The
このように、テキスト処理装置1では、高速な圧縮パターン照合に適した文節木2aが作成できる。
〔第2の実施の形態〕
第2の実施の形態は、圧縮パターン照合による検索を行うシステムに対して、第1の実施の形態に係るテキスト符号化技術を適用したものである。
Thus, the
[Second Embodiment]
In the second embodiment, the text encoding technique according to the first embodiment is applied to a system that performs a search by compressed pattern matching.
図2は、システム構成の一例を示す図である。図2の例では、サーバ100に対して複数のクライアント201,202がネットワーク10を介して接続されている。サーバ100は、クライアント201,202から入力されたテキスト文書を符号化により圧縮し、保持する。また、サーバ100は、クライアント201,202からのテキスト検索の要求に応答して、圧縮して保持したテキスト文書から検索要求(検索クエリ)に合致する文字を検索する。さらにサーバ100は、クライアント201,202からの解凍要求に応答して、圧縮したテキスト文書を元の状態に解凍する。
FIG. 2 is a diagram illustrating an example of a system configuration. In the example of FIG. 2, a plurality of
クライアント201,202は、ユーザが使用するコンピュータである。ユーザは、クライアント201,202を操作して、クライアント201,202からサーバ100へテキスト文書を送信することができる。またユーザは、クライアント201,202を操作して、クライアント201,202からサーバ100へ、検索要求や解凍要求を送信することができる。
図3は、本実施の形態に用いるサーバのハードウェアの一構成例を示す図である。サーバ100は、CPU(Central Processing Unit)101によって装置全体が制御されている。CPU101には、バス108を介してRAM(Random Access Memory)102と複数の周辺機器が接続されている。
FIG. 3 is a diagram illustrating a configuration example of server hardware used in the present embodiment. The
RAM102は、サーバ100の主記憶装置として使用される。RAM102には、CPU101に実行させるOS(Operating System)のプログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。また、RAM102には、CPU101による処理に必要な各種データが格納される。
The
バス108に接続されている周辺機器としては、ハードディスクドライブ(HDD:Hard Disk Drive)103、グラフィック処理装置104、入力インタフェース105、光学ドライブ装置106、および通信インタフェース107がある。
Peripheral devices connected to the
HDD103は、内蔵したディスクに対して、磁気的にデータの書き込みおよび読み出しを行う。HDD103は、サーバ100の二次記憶装置として使用される。HDD103には、OSのプログラム、アプリケーションプログラム、および各種データが格納される。なお、二次記憶装置としては、フラッシュメモリなどの半導体記憶装置を使用することもできる。
The
グラフィック処理装置104には、モニタ11が接続されている。グラフィック処理装置104は、CPU101からの命令に従って、画像をモニタ11の画面に表示させる。モニタ11としては、CRT(Cathode Ray Tube)を用いた表示装置や液晶表示装置などがある。
A monitor 11 is connected to the
入力インタフェース105には、キーボード12とマウス13とが接続されている。入力インタフェース105は、キーボード12やマウス13から送られてくる信号をCPU101に送信する。なお、マウス13は、ポインティングデバイスの一例であり、他のポインティングデバイスを使用することもできる。他のポインティングデバイスとしては、タッチパネル、タブレット、タッチパッド、トラックボールなどがある。
A
光学ドライブ装置106は、レーザ光などを利用して、光ディスク14に記録されたデータの読み取りを行う。光ディスク14は、光の反射によって読み取り可能なようにデータが記録された可搬型の記録媒体である。光ディスク14には、DVD(Digital Versatile Disc)、DVD−RAM、CD−ROM(Compact Disc Read Only Memory)、CD−R(Recordable)/RW(ReWritable)などがある。
The
通信インタフェース107は、ネットワーク10に接続されている。通信インタフェース107は、ネットワーク10を介して、他のコンピュータまたは通信機器との間でデータの送受信を行う。
The
以上のようなハードウェア構成によって、本実施の形態の処理機能を実現することができる。なお、図3にはサーバ100のハードウェア構成を示したが、クライアント201,202も同様のハードウェア構成で実現することができる。
With the hardware configuration as described above, the processing functions of the present embodiment can be realized. Although FIG. 3 shows the hardware configuration of the
次に、要約トライのデータ構造について説明する。要約トライは、トライ木(Trie)と呼ばれる順序付き木構造を有する。要約トライは、ノード(節点)を表すノード構造体がポインタで繋がれている。 Next, the data structure of the summary trie will be described. A summary trie has an ordered tree structure called a trie. In the summary trie, node structures representing nodes (nodes) are connected by a pointer.
図4は、要約トライのノード構造体の一例を示す図である。ノード構造体20には、ノードID21、ラベル22、子ノードのカウンタリスト23、および子ノードへのポインタリスト24が設けられている。
FIG. 4 is a diagram illustrating an example of the node structure of the summary trie. The node structure 20 is provided with a
ノードID21は、ノード構造体20を識別するための識別子である。ノードID21には、ノード構造体20の作成順に、1ずつインクリメントされた1以上の整数が代入される。ノードID21は、圧縮符号として使用される。
The
ラベル22は、ノード構造体20に対応する文字である。子ノードのノード構造体20が、親ノードのノード構造体の配下に、対応する文字に応じた所定の配列で接続される場合、その配列上の順番により各ノード構造体に対応する文字が特定できる。この場合、ノード構造体20がラベル22を有していなくてもよい。
The
子ノードのカウンタリスト23には、処理対象のテキストデータに存在し得る文字の種類に応じたカウンタが設けられている。例えばテキストデータに存在し得る文字がアルファベットであれば、アルファベットの文字数分のカウンタが用意される。また、テキストデータに所定のコード体系による1バイト文字が存在し得る場合、256個のカウンタが用意される。子ノードのカウンタリスト23に含まれる各カウンタは、子ノードに対応付けられている。子ノードに対応するカウンタには、ルートノードからノード構造体20のノードに到達するまでの各ノードの文字列の次に、その子ノードに対応する文字が出現した回数が設定される。なお、各カウンタの初期値は「0」である。
The child
子ノードへのポインタリスト24には、処理対象のテキストデータに存在し得る文字の種類に応じたポインタが設けられている。例えばテキストデータに存在し得る文字がアルファベットであれば、アルファベットの文字数分のポインタが用意される。また、テキストデータに所定のコード体系による1バイト文字が存在し得る場合、256個のポインタが用意される。子ノードへのポインタリスト24に含まれる各ポインタは、子ノードに対応付けられている。子ノードに対応するポインタには、子ノードのノード構造体を一意に特定する情報が設定される。各ポインタの初期値は「NULL」である。
In the
このようなノード構造体のノードを繋げることで、順序付き木構造(トライ)である要約トライが作成される。
図5は、要約トライの例を示す図である。図5の例では、テキストデータに存在し得る文字を「a,b,c,d」とし、これらの文字を含む集合Σ(Σ={a,b,c,d})を定義している。この場合、Σに含まれる要素数(|Σ|)は、「4」となる。
By connecting the nodes of such a node structure, a summary trie that is an ordered tree structure (trie) is created.
FIG. 5 is a diagram illustrating an example of a summary trie. In the example of FIG. 5, the characters that can exist in the text data are “a, b, c, d”, and a set Σ (Σ = {a, b, c, d}) including these characters is defined. . In this case, the number of elements (| Σ |) included in Σ is “4”.
要約トライ30は、複数のノード31〜37で構成されている。各ノード31〜37は、図4に示したようなノード構造体を有する。各ノード31〜37における子ノードのカウンタリストには、a,b,c,dそれぞれに対応するカウンタが設けられている。各ノード31〜37における子ノードへのポインタリストには、a,b,c,dそれぞれに対応するポインタが設けられている。
The summary trie 30 is composed of a plurality of
ノード31はルートノードであり、ノードIDは「0」である。ルートノードであるノード31のラベルには「root」と設定されている。ノード32は文字「a」に対応するノードであり、ラベルには「a」と設定されている。ノード32のノードIDは「1」である。ノード33は文字「b」に対応するノードであり、ラベルには「b」と設定されている。ノード33のノードIDは「2」である。ノード34は文字「c」に対応するノードであり、ラベルには「c」と設定されている。ノード34のノードIDは「3」である。ノード35は文字「d」に対応するノードであり、ラベルには「d」と設定されている。ノード35のノードIDは「4」である。ノード36は文字「b」に対応するノードであり、ラベルには「b」と設定されている。ノード36のノードIDは「5」である。ノード37は文字「c」に対応するノードであり、ラベルには「c」と設定されている。ノード37のノードIDは「6」である。
The
ノード31に設けられた子ノードのカウンタリスト内のカウンタの値は、すべて「0」である。また、ノード31に設けられた子ノードへのポインタリストには、子ノードである4つのノード32〜35へのポインタが設定されている。
The values of the counters in the counter list of the child node provided in the
なお図5では、ポインタとそのポインタが指し示すノードとを、矢印で接続している。また「NULL」ポインタを、図中「・」で示している。
ノード32に設けられた子ノードのカウンタリスト内の各カウンタのうち、文字「b」に対応するカウンタのみ「2」が設定され、その他のカウンタの値は「0」である。図5の例では、カウンタの値が「2」に達すると、該当カウンタに対応する文字の子ノードが作成されるものとする。そこで、ノード32の子ノードとして、文字「b」に対応するノード36が作成されている。ノード32の文字「b」に対応するポインタは、ノード36を指し示している。
In FIG. 5, the pointer and the node pointed to by the pointer are connected by an arrow. The “NULL” pointer is indicated by “•” in the figure.
Of the counters in the counter list of the child node provided in the
ノード33〜35には、値が「2」に達したカウンタがないため、子ノードも作成されていない。ノード36は、文字「c」に対応するカウンタが「2」となり、文字「c」に対応する子ノードとしてノード37が作成されている。
Since the
このような要約トライ30を用いて文字列の符号化が可能となる。例えば、「a,b,c」の文字列は、ルートのノード31からノード37までの経路に対応する。そこで、文字列「a,b,c」をノード37のノードID「6」に符号化することができる。
A character string can be encoded using such a
第2の実施の形態では、テキストデータの文字を1文字ずつ読み込み、順次、要約トライ30の作成と文字列の符号化を行う。このように、要約トライの作成と文字列の符号化のストリーム処理を可能とすることで、テキストデータ符号化処理の効率化が可能となる。 In the second embodiment, characters of text data are read one character at a time, and a summary trie 30 is created and a character string is encoded sequentially. As described above, stream processing for creating a summary trie and encoding a character string is possible, thereby improving the efficiency of the text data encoding process.
図6は、サーバの機能を示すブロック図である。サーバ100は、符号化辞書記憶部110、圧縮済テキスト記憶部120、テキスト符号化部130、検索部140、および解凍部150を有する。なお図6の例では、クライアント201から未圧縮テキスト40が入力され、クライアント202から検索クエリ41または解凍要求43が入力されるものとする。
FIG. 6 is a block diagram illustrating functions of the server. The
符号化辞書記憶部110は、符号化辞書として使用する要約トライを記憶する。例えば、RAM102またはHDD103の記憶領域の一部が符号化辞書記憶部110として使用される。
The encoding
圧縮済テキスト記憶部120は、符号化によりデータ量が圧縮されたテキストデータ(圧縮済テキスト)を記憶する。例えば、RAM102またはHDD103の記憶領域の一部が圧縮済テキスト記憶部120として使用される。
The compressed
テキスト符号化部130は、クライアント201から入力された未圧縮テキスト40内の文字列を符号化し、データ量を圧縮する。なおテキスト符号化部130は、文字列を符号化する際に、要約トライ形式の符号化辞書を作成する。テキスト符号化部130は、作成した要約トライを、符号化辞書記憶部110に格納する。またテキスト符号化部130は、データ量が圧縮された圧縮済テキストを、圧縮済テキスト記憶部120に格納する。
The
検索部140は、クライアント202から入力された検索クエリに応答し、圧縮済テキスト記憶部120内の圧縮済テキストを参照し、検索クエリで指定される文字列に合致する文字列の未圧縮テキスト40上での位置を特定する。なお、圧縮済テキストに対する検索には、例えば可変長情報源を固定長に符号化するVF符号化技術で符号化されたVF符号のパターン照合技術を用いることができる。なお圧縮されたテキストに対するパターン照合では、圧縮されたテキストを解凍せずにパターン照合を行うことができる。例えばSIGMA検索アルゴリズム、KMP(Knuth-Morris-Pratt)アルゴリズム、AC(Aho-Corasick)アルゴリズムなどを用いたパターン照合が可能である。検索部140は、検索結果42をクライアント202に送信する。検索結果42には、例えば、検索でヒットした文字列の未圧縮テキスト40内での位置(何文字目から何文字目か)が示される。
The
解凍部150は、クライアント202から入力された解凍要求に応答し、圧縮済テキスト記憶部120内の圧縮済テキストを解凍する。そして解凍部150は、解凍した解凍済テキスト44をクライアント202に送信する。
In response to the decompression request input from the
次にテキスト符号化部130の詳細について説明する。
図7は、テキスト符号化部の詳細機能を示すブロック図である。テキスト符号化部130は、頻度閾値記憶部131、最大符号数記憶部132、文字選択部133、ノード作成部134、頻度カウント部135、および符号出力部136を有する。
Next, details of the
FIG. 7 is a block diagram showing detailed functions of the text encoding unit. The
頻度閾値記憶部131は、文字列の出現頻度の閾値を記憶する。例えば、RAM102やHDD103の記憶領域の一部が、頻度閾値記憶部131として使用される。出現頻度が閾値を超えた文字列については、対応するノードが作成される。
The frequency
最大符号数記憶部132には、要約トライに含まれる符号の最大数を示す最大符号数を記憶する。例えば、RAM102やHDD103の記憶領域の一部が、最大符号数記憶部132として使用される。要約トライの符号数が最大符号数に達すると、それ以降予約トライは更新されない。
The maximum code
文字選択部133は、入力された未圧縮テキスト40内の先頭から、文字を1文字ずつ選択する。文字選択部133は、選択した文字をノード作成部134、頻度カウント部135、および符号出力部136に渡す。なお、文字選択部133は、入力された未圧縮テキスト40を、例えばRAM102内に一時的に格納しておき、RAM102内から1文字ずつ文字を選択することができる。
The
ノード作成部134は、文字選択部133から文字を取得するごとに、要約トライに対するノードの作成の要否を判断する。なお、ノード作成部134は、要約トライに含まれるノードのうち、判断位置となるノードを示す情報(ノードポインタ)を管理している。そして、ノード作成部134は、判断位置のノードのノード構造体と取得した文字とを比較することで、ノードの作成の要否を判断する。ノードの作成が必要と判断した場合、ノード作成部134は、新たなノード構造体を作成し、そのノード構造体を符号化辞書記憶部110に格納されている要約トライに追加する。
Each time the
頻度カウント部135は、文字選択部133から文字を取得すると、要約トライ内の判断位置のノードに設けられているカウンタを更新する。例えば、文字選択部133から取得した文字までの符号化されていない部分文字列に対応するノードがまだ作成されていない場合、頻度カウント部135は、その文字に対応するカウンタの値をカウントアップする。
When the
符号出力部136は、文字選択部133から文字を取得するごとに、符号化されていない部分文字列に対応する符号の出力の要否を判断する。そして符号出力部136は、符号を出力する場合、要約トライ内のノードのノードIDを符号として圧縮済テキスト記憶部120に格納する。例えば、判断位置となるノードが要約トライの葉であり、文字選択部133が選択した文字に対応するノードが、判断位置となるノードの子ノードとして新たに作成されない場合、符号出力部136は符号を出力する。この場合、符号出力部136は、文字選択部133から取得した文字の直前の文字までの符号化されていない部分文字列を、判断位置となるノードのノードIDに符号化する。そして符号出力部136は、符号を圧縮済テキスト記憶部120に格納する。
Each time the
次に、テキスト符号化処理の手順について詳細に説明する。なお、テキスト符号化処理の入力は、未圧縮テキスト40、閾値、および最大符号数である。
ここで未圧縮テキスト40に含まれる文字数を「n」(nは1以上の整数)とする。そして、未圧縮テキスト40内の文字列を、配列を用いてT=T[1],・・・,T[n]と定義する。
Next, the procedure of the text encoding process will be described in detail. The input of the text encoding process is the
Here, the number of characters included in the
また、閾値の値は、頻度閾値記憶部131から読み出され、変数「α」に設定される。さらに、最大符号数の値は、最大符号数記憶部132から読み出され、変数「K」に設定される。
The threshold value is read from the frequency
テキスト符号化処理の出力は、要約トライと圧縮済テキストである。ここで要約トライを「D」とする。要約トライ「D」の構造は、図5に示したように、複数のノード構造体をポインタで関連付けたものである。また圧縮済テキストを「C=Compress(T)」とする。圧縮済テキスト「C」は、符号化により生成された符号が、生成順に並べられた情報である。 The output of the text encoding process is a summary trie and compressed text. Here, it is assumed that the summary trie is “D”. The structure of the summary trie “D” is obtained by associating a plurality of node structures with pointers as shown in FIG. Further, the compressed text is “C = Compress (T)”. The compressed text “C” is information in which codes generated by encoding are arranged in the order of generation.
テキスト符号化処理では、要約トライ「D」中の判断位置のノードを示すノードポインタ「P」が用いられる。例えばノードポインタ「P」には、判断位置のノードのノードIDが設定される。 In the text encoding process, a node pointer “P” indicating the node at the determination position in the summary trie “D” is used. For example, the node pointer “P” is set with the node ID of the node at the determination position.
また、要約トライの現在の大きさを「k」とする。要約トライ「D」の大きさ「k」は、その要約トライ「D」に含まれる符号数である。なお図5の例のように、要約トライのルートノードのノードIDを「0」とし、その他のノードに対して「1」から順にノードIDを付与した場合、要約トライ「D」に含まれる符号数はノードIDの最大値と等しくなる。 Also, the current size of the summary trie is “k”. The size “k” of the summary trie “D” is the number of codes included in the summary trie “D”. If the node ID of the root node of the summary trie is “0” and the node IDs are assigned in order from “1” to the other nodes as in the example of FIG. 5, the codes included in the summary trie “D” The number is equal to the maximum value of the node ID.
テキストデータ中の現在の処理対象の文字の位置を「i」とする。位置iは、0以上の整数を採ることができる。文字の位置は、テキスト中の先頭からの該当文字の順番で表される。配列「T」のインデックスに、処理対象の文字の順番を示す位置「i」を設定することで、処理対象の文字が抽出できる。 The position of the current character to be processed in the text data is “i”. The position i can take an integer of 0 or more. The position of the character is represented by the order of the corresponding character from the beginning in the text. By setting the position “i” indicating the order of the characters to be processed to the index of the array “T”, the characters to be processed can be extracted.
図8は、テキスト符号化処理の手順を示すフローチャートである。以下、図8に示す処理をステップ番号に沿って説明する。
[ステップS11]テキスト符号化部130内の各要素は、それぞれ情報の初期化を行う。例えば文字選択部133は、文字の位置「i」の値を「0」に初期化する。
FIG. 8 is a flowchart showing the procedure of the text encoding process. In the following, the process illustrated in FIG. 8 will be described in order of step number.
[Step S11] Each element in the
ノード作成部134は、符号化辞書記憶部110内の要約トライ「D」を初期化する。初期化された要約トライ「D」は、すべてのアルファベットがカウント「0」で登録された状態を表している。例えばノード作成部134は、ルートノードのノード構造体を作成し、ルートノードのノード構造体の配下に、集合Σに含まれる各要素に対応する子ノードのノード構造体を繋げる。この際、ノード作成部134は、各ノードに含まれるカウンタの値はすべて「0」とする。またノード作成部134は、ルートノード以外の各ノードのポインタの値は「NULL」とする。初期状態の符号数は集合Σ内の要素数であり、その要素数が、要約トライの大きさ「k」に設定される。
The
さらにノード作成部134は、ノードポインタ「P」を初期化する。ノードポインタ「P」の初期値では、要約トライ「D」のルートノードが指し示され、「P=root(D)」と表される。
Further, the
符号出力部136は、圧縮済テキスト記憶部120内の圧縮済テキストを初期化する。初期化された圧縮済テキストには、空文字列が設定され、「C=ε」と表される。εは空文字列を意味する。
The
[ステップS12]文字選択部133は、位置「i」の値をインクリメントする(i=i+1)。これにより、未圧縮テキスト40内の1文字目が処理対象となる。
[ステップS13]ノード作成部134は、位置「i」の値が、文字数「n」より大きいか否かを判断する。位置「i」の値が文字数「n」より大きければ、処理がステップS20に進められる。位置「i」の値が文字数「n」以下であれば、処理がステップS14に進められる。
[Step S12] The
[Step S13] The
[ステップS14]位置「i」の値が文字数「n」以下であれば、ノード作成部134、頻度カウント部135、および符号出力部136が連携し、要約トライ作成およびテキスト圧縮処理を実行する。この処理の詳細は後述する(図9参照)。
[Step S14] If the value of the position “i” is equal to or less than the number of characters “n”, the
[ステップS15]文字選択部133は、位置「i」の値をインクリメントする(i=i+1)。これにより、未圧縮テキスト40内の次の文字が処理対象となる。
[ステップS16]ノード作成部134は、要約トライ「D」の大きさ「k」が、最大符号数「K」未満か否かを判断する。要約トライ「D」の大きさ「k」が最大符号数「K」未満であれば、処理がステップS13に進められる。要約トライ「D」の大きさ「k」が最大符号数「K」以上であれば、処理がステップS17に進められる。
[Step S15] The
[Step S16] The
[ステップS17]ノード作成部134は、位置「i」の値が、文字数「n」より大きいか否かを判断する。位置「i」の値が文字数「n」より大きければ、処理がステップS20に進められる。位置「i」の値が文字数「n」以下であれば、処理がステップS18に進められる。
[Step S17] The
[ステップS18]位置「i」の値が文字数「n」以下であれば、符号出力部136は、テキスト圧縮処理を実行する。この処理の詳細は後述する(図10参照)。
[ステップS19]文字選択部133は、位置「i」の値をインクリメントする(i=i+1)。これにより、未圧縮テキスト40内の次の文字が処理対象となる。その後、処理がステップS17に進められる。
[Step S18] If the value of the position “i” is equal to or less than the number of characters “n”, the
[Step S19] The
[ステップS20]位置「i」の値が文字数「n」より大きくなると、符号出力部136は、ノードポインタ「P」が示すノードの符号を、圧縮済テキスト「C」の末尾に書き出す。その後、処理が終了する。
[Step S20] When the value of the position “i” becomes larger than the number of characters “n”, the
次に、要約トライ作成およびテキスト圧縮処理(ステップS14)の詳細について説明する。
図9は、要約トライ作成およびテキスト圧縮処理の手順を示すフローチャートである。以下、図9に示す処理をステップ番号に沿って説明する。
Next, details of the summary trie creation and text compression processing (step S14) will be described.
FIG. 9 is a flowchart showing a procedure of summary trie creation and text compression processing. In the following, the process illustrated in FIG. 9 will be described in order of step number.
[ステップS21]ノード作成部134は、ノードポインタ「P」で示されるノードの子ノードの中に、処理対象の文字「T[i]」に対応する子ノードが存在するか否かを判断する。具体的には、ノード作成部134は、文字選択部133からT[i]に対応する文字を取得する。次にノード作成部134は、ノードポインタ「P」で示されるノードのノード構造体を参照し、取得した文字に対応するポインタの内容を確認する。該当ポインタが「NULL」以外の有効な値であれば、取得した文字に対応する子ノードが存在する。
[Step S21] The
子ノードが存在する場合、処理がステップS22に進められる。子ノードが存在しない場合、処理がステップS23に進められる。
[ステップS22]子ノードが存在する場合、ノード作成部134は、現在のノードポインタ「P」で指定されているノードの文字「T[i]」に対応する子ノードを、新たにノードポインタ「P」の指定先とする。その後、要約トライ作成およびテキスト圧縮処理が終了し、図8のステップS15に処理が進められる。
If a child node exists, the process proceeds to step S22. If no child node exists, the process proceeds to step S23.
[Step S22] When a child node exists, the
[ステップS23]子ノードが存在しない場合、頻度カウント部135は、現在のノードポインタ「P」で指定されているノード内の、取得した文字に対応するカウンタの値を1増加させる。ノードポインタ「P」で示されるノードにおける文字「T[i]」の出現頻度を表すカウンタの値は、「count(P,T[i])」と表記できる。
[Step S23] When there is no child node, the
[ステップS24]ノード作成部134は、現在のノードポインタ「P」で指定されているノード内の、取得した文字に対応するカウンタ(count(P,T[i]))の値が、閾値「α」と等しいか否かを判断する。カウンタの値が閾値「α」と等しい場合、処理がステップS25に進められる。等しくなければ、処理がステップS28に進められる。
[Step S24] The
[ステップS25]カウンタの値が閾値「α」と等しい場合、ノード作成部134は、現在のノードポインタ「P」で指定されているノードの配下に、文字「T[i]」に対応する子ノードを作成する。具体的には、ノード作成部134は、新たなノードIDを付与したノード構造体を生成する。例えばノード作成部134は、最後に作成したノードのノードIDを記憶しておき、そのノードIDに1を加算した値を、作成したノードのノードIDとする。作成されたノードのラベルは、文字「T[i]」である。また作成されたノード構造体内の各カウンタおよび各ポインタには初期値が設定される。そしてノード作成部134は、現在のノードポインタ「P」で指定されているノードにおける文字「T[i]」に対応するポインタに、新たに作成したノードを指し示す値を設定する。
[Step S25] When the value of the counter is equal to the threshold value “α”, the
[ステップS26]ノード作成部134は、ノードポインタ「P」の指定先を、ステップS25で新たに作成した子ノードとする。
[ステップS27]ノード作成部134は、要約トライ「D」の大きさ「k」の値をインクリメントする。その後、要約トライ作成およびテキスト圧縮処理が終了し、図8のステップS15に処理が進められる。
[Step S26] The
[Step S27] The
[ステップS28]ステップS24でカウンタの値が閾値「α」と等しくないと判断された場合、符号出力部136は、ノードポインタ「P」で指定されたノードの符号を、圧縮済テキスト「C」の末尾に書き出す。
[Step S28] When it is determined in step S24 that the value of the counter is not equal to the threshold value “α”, the
[ステップS29]ノード作成部134は、ノードポインタ「P」の指定先を、ルートノードの子ノードのうちの、文字「T[i]」に対応するルートノードの子ノードとする。その後、要約トライ作成およびテキスト圧縮処理が終了し、図8のステップS15に処理が進められる。
[Step S29] The
次に、テキスト圧縮処理(ステップS18)の詳細について説明する。
図10は、要約トライ作成およびテキスト圧縮処理の手順を示すフローチャートである。以下、図10に示す処理をステップ番号に沿って説明する。
Next, details of the text compression process (step S18) will be described.
FIG. 10 is a flowchart showing a procedure of summary trie creation and text compression processing. In the following, the process illustrated in FIG. 10 will be described in order of step number.
[ステップS31]符号出力部136は、ノードポインタ「P」で示されるノードの子ノードの中に、処理対象の文字「T[i]」に対応する子ノードが存在するか否かを判断する。子ノードが存在する場合、処理がステップS32に進められる。子ノードが存在しない場合、処理がステップS33に進められる。
[Step S31] The
[ステップS32]子ノードが存在する場合、符号出力部136は、現在のノードポインタ「P」で指定されているノードの文字「T[i]」に対応する子ノードを、新たにノードポインタ「P」の指定先とする。その後、テキスト圧縮処理が終了し、図8のステップS19に処理が進められる。
[Step S32] When there is a child node, the
[ステップS33]子ノードが存在しない場合、符号出力部136は、ノードポインタ「P」で指定されたノードの符号を、圧縮済テキスト「C」の末尾に書き出す。
[ステップS34]符号出力部136は、ノードポインタ「P」の指定先を、ルートノードの子ノードのうちの、文字「T[i]」に対応する子ノードとする。その後、要約トライ作成およびテキスト圧縮処理が終了し、図8のステップS19に処理が進められる。
[Step S33] If no child node exists, the
[Step S34] The
このようにして、要約トライ「D」と圧縮済テキスト「C」とが作成される。ここで、カウンタの値が閾値「α」に達した場合にのみ要約トライ「D」に対して子ノードを追加するため、出現頻度の高い文字列に対応するノードのみ作成することができる。 In this way, the summary trie “D” and the compressed text “C” are created. Here, since a child node is added to the summary trie “D” only when the value of the counter reaches the threshold value “α”, only a node corresponding to a character string having a high appearance frequency can be created.
しかも要約トライ「D」の大きさ「k」が最大符号数「K」以上となると、要約トライ「D」は更新されずテキスト圧縮処理による圧縮済テキスト「C」の作成のみが継続される。すなわち、要約トライ「D」の大きさが最大符号数を超えたら、要約トライ「D」のノードカウンタが閾値「α」を超えても、新たなノードは作られない。これにより、要約トライ「D」の大きさは所定値以下に抑制される。 Moreover, when the size “k” of the summary trie “D” becomes equal to or greater than the maximum code number “K”, the summary trie “D” is not updated and only the creation of the compressed text “C” by the text compression process is continued. That is, if the size of the summary trie “D” exceeds the maximum number of codes, a new node is not created even if the node counter of the summary trie “D” exceeds the threshold “α”. Thereby, the size of the summary trie “D” is suppressed to a predetermined value or less.
次に、具体的な要約トライと圧縮済テキストとの生成例について説明する。
図11は、初期状態の要約トライと圧縮済テキストの例を示す図である。図11の例では、未圧縮テキスト40に含まれ得る文字が「a,b,c,d」の4文字であるものとする。すなわち、集合Σ={a,b,c,d}であり、アルファベットサイズ(|Σ|)=4である。入力された未圧縮テキスト40内の文字列を”abcabcdabc”とする。すなわち、配列T=”abcabcdabc”となる。また、閾値「α=2」、最大符号数「K=256」であるものとする。最大符号数が「256(2の8乗)」であるということは、符号が1バイトの固定長であることを示す。
Next, a specific example of generating a summary trie and compressed text will be described.
FIG. 11 is a diagram illustrating an example of an initial summary trie and compressed text. In the example of FIG. 11, it is assumed that the characters that can be included in the
初期化フェーズにおいて、初期状態の要約トライ50が作成される。作成された要約トライ50は、5つのノード51〜55を有する。ノード51は、ルートノードである。ノード52〜55は、それぞれ文字「a,b,c,d」に対応するノード51の子ノードである。ノード51には、子ノードであるノード52〜55それぞれへのポインタが設定されている。
In the initialization phase, an initial summary trie 50 is created. The created summary trie 50 has five
初期状態では、各ノード51〜55内のカウンタの値はすべて「0」である。また初期状態では、ノードポインタ「P」はノード51を指し示している(P=root(D))。なお図11の例では、ノードポインタ「P」で指し示されるノードに、「P」の文字が書かれた旗の図形を付与している。
In the initial state, the values of the counters in the
圧縮済テキスト60には、初期化処理により空文字列(ε)が設定される。また処理対象の文字の位置「i」には、「0」が設定される。
図11に示した状態から位置「i」がインクリメントされ、i=1とされる。そして、未圧縮テキスト40内の先頭の文字「a」が処理対象として選択される。
An empty character string (ε) is set in the compressed text 60 by the initialization process. In addition, “0” is set in the position “i” of the character to be processed.
The position “i” is incremented from the state shown in FIG. 11 so that i = 1. Then, the first character “a” in the
図12は、1文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。初期状態においてノードポインタ「P」で指定されていたルートのノード51には、すべての文字に対応する子ノードが存在する。そこで、1文字目の文字「a」に応じて、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「a」に対応するノード52に変更される。この際、圧縮済テキスト60への符号の書き出しは行われない。
FIG. 12 is a diagram illustrating an example of the summary trie and the compressed text after the first character is processed. In the
図12に示した状態から位置「i」がインクリメントされ、i=2とされる。そして、未圧縮テキスト40内の2文字目の文字「b」が処理対象として選択される。
図13は、2文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード52には、文字「b」に対応する子ノードが存在しない。そこで、ノード52内の文字「b」に対応するカウンタが「1」にカウントアップされている(count(1,b)=1)。このとき、count(1,b)<αである。そこで、圧縮済テキスト60」の末尾に、ノード52に対応する符号「1」が書き出される。その結果、圧縮済テキスト60は「C=1」となる。そして、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「b」に対応するノード53に変更される。
The position “i” is incremented from the state shown in FIG. 12, and i = 2. Then, the second character “b” in the
FIG. 13 is a diagram illustrating an example of the summary trie and the compressed text after the second character is processed. The
図13に示した状態から位置「i」がインクリメントされ、i=3とされる。そして、未圧縮テキスト40内の3文字目の文字「c」が処理対象として選択される。
図14は、3文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード53には、文字「c」に対応する子ノードが存在しない。そこで、ノード53内の文字「c」に対応するカウンタが「1」にカウントアップされている(count(2,c)=1)。このとき、count(2,c)<αである。そこで、圧縮済テキスト60の末尾に、ノード53に対応する符号「2」が書き出される。その結果、圧縮済テキスト60は「C=12」となる。そして、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「c」に対応するノード54に変更される。
The position “i” is incremented from the state shown in FIG. 13 so that i = 3. Then, the third character “c” in the
FIG. 14 is a diagram illustrating an example of the summary trie and the compressed text after the third character is processed. The
図14に示した状態から位置「i」がインクリメントされ、i=4とされる。そして、未圧縮テキスト40内の4文字目の文字「a」が処理対象として選択される。
図15は、4文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード54には、文字「a」に対応する子ノードが存在しない。そこで、ノード54内の文字「a」に対応するカウンタが「1」にカウントアップされている(count(3,a)=1)。このとき、count(3,a)<αである。そこで、圧縮済テキスト60の末尾に、ノード54に対応する符号「3」が書き出される。その結果、圧縮済テキスト60は「C=123」となる。そして、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「a」に対応するノード52に変更される。
The position “i” is incremented from the state shown in FIG. 14, and i = 4. Then, the fourth character “a” in the
FIG. 15 is a diagram illustrating an example of the summary trie and the compressed text after the fourth character is processed. The
図15に示した状態から位置「i」がインクリメントされ、i=5とされる。そして、未圧縮テキスト40内の5文字目の文字「b」が処理対象として選択される。
図16は、5文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード52には、文字「b」に対応する子ノードが存在しない。そこで、ノード52内の文字「b」に対応するカウンタが「2」にカウントアップされている(count(1,b)=2)。このとき、count(1,b)=αである。そこで、ノード52の文字「b」に対応する子ノードとしてノード56が作成される。この際、ノード52の文字「b」に対応するポインタには、ノード56を示す値が設定される。新たに作成されたノード56には、ノードID「5」が付与され、ラベル「b」が設定される。ノード56内のカウンタとポインタとには、初期値が設定される。そして、ノードポインタ「P」の指定先が、新たに作成したノード56に変更される。この際、圧縮済テキスト60への符号の書き出しは行われない。
The position “i” is incremented from the state shown in FIG. 15, and i = 5. Then, the fifth character “b” in the
FIG. 16 is a diagram illustrating an example of the summary trie and the compressed text after processing the fifth character. The
図16に示した状態から位置「i」がインクリメントされ、i=6とされる。そして、未圧縮テキスト40内の6文字目の文字「c」が処理対象として選択される。
図17は、6文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード56には、文字「c」に対応する子ノードが存在しない。そこで、ノード56内の文字「c」に対応するカウンタが「1」にカウントアップされている(count(5,c)=1)。このとき、count(5,c)<αである。そこで、圧縮済テキスト60の末尾に、ノード56に対応する符号「5」が書き出される。その結果、圧縮済テキスト60は「C=1235」となる。そして、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「c」に対応するノード54に変更される。
The position “i” is incremented from the state shown in FIG. 16, and i = 6. Then, the sixth character “c” in the
FIG. 17 is a diagram illustrating an example of the summary trie and the compressed text after processing the sixth character. The
図17に示した状態から位置「i」がインクリメントされ、i=7とされる。そして、未圧縮テキスト40内の7文字目の文字「d」が処理対象として選択される。
図18は、7文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。図17の状態のままではノード54には、文字「d」に対応する子ノードが存在しない。そこで、ノード54内の文字「d」に対応するカウンタが「1」にカウントアップされている(count(3,d)=1)。このとき、count(3,d)<αである。そこで、圧縮済テキスト60の末尾に、ノード54に対応する符号「3」が書き出される。その結果、圧縮済テキスト60は「C=12353」となる。そして、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「d」に対応するノード55に変更される。
The position “i” is incremented from the state shown in FIG. 17 so that i = 7. Then, the seventh character “d” in the
FIG. 18 is a diagram illustrating an example of the summary trie and the compressed text after processing the seventh character. In the state of FIG. 17, the
図18に示した状態から位置「i」がインクリメントされ、i=8とされる。そして、未圧縮テキスト40内の8文字目の文字「a」が処理対象として選択される。
図19は、8文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード55には、文字「a」に対応する子ノードが存在しない。そこで、ノード55内の文字「a」に対応するカウンタが「1」にカウントアップされている(count(4,a)=1)。このとき、count(4,a)<αである。そこで、圧縮済テキスト60の末尾に、ノード55に対応する符号「4」が書き出される。その結果、圧縮済テキスト60は「C=123534」となる。そして、ノードポインタ「P」の指定先が、ノード51の子ノードのうちの「a」に対応するノード52に変更される。
The position “i” is incremented from the state shown in FIG. 18, and i = 8. Then, the eighth character “a” in the
FIG. 19 is a diagram illustrating an example of the summary trie and the compressed text after processing the eighth character. The
図19に示した状態から位置「i」がインクリメントされ、i=9とされる。そして、未圧縮テキスト40内の9文字目の文字「b」が処理対象として選択される。
図20は、9文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。ノード52には、文字「b」に対応する子ノードが存在する。そこで、9文字目の文字「b」に応じて、ノードポインタ「P」の指定先が、ノード52の子ノードのうちの「b」に対応するノード56に変更される。この際、圧縮済テキスト60への符号の書き出しは行われない。
The position “i” is incremented from the state shown in FIG. 19, and i = 9. Then, the ninth character “b” in the
FIG. 20 is a diagram illustrating an example of the summary trie and the compressed text after the ninth character has been processed. The
図20に示した状態から位置「i」がインクリメントされ、i=10とされる。そして、未圧縮テキスト40内の10文字目の文字「c」が処理対象として選択される。
図21は、10文字目を処理した後の要約トライと圧縮済テキストの例を示す図である。図20の状態のままではノード56には、文字「c」に対応する子ノードが存在しない。そこで、ノード56内の文字「c」に対応するカウンタが「2」にカウントアップされている(count(5,c)=2)。このとき、count(5,c)=αである。そこで、ノード52の文字「c」に対応する子ノードとしてノード57が作成される。この際、ノード56の文字「c」に対応するポインタには、ノード57を示す値が設定される。新たに作成されたノード57には、ノードID「6」が付与され、ラベル「c」が設定される。ノード57内のカウンタとポインタとには、初期値が設定される。そして、ノードポインタ「P」の指定先が、新たに作成したノード57に変更される。この際、圧縮済テキスト60への符号の書き出しは行われない。
The position “i” is incremented from the state shown in FIG. 20 so that i = 10. Then, the tenth character “c” in the
FIG. 21 is a diagram illustrating an example of the summary trie and the compressed text after the 10th character is processed. In the state of FIG. 20, the
図21に示した状態から位置「i」がインクリメントされ、i=11とされる。テキストには11文字目は存在しない。そのため位置「i」の値が文字数「n」より大きくなる。 The position “i” is incremented from the state shown in FIG. 21 so that i = 11. The eleventh character does not exist in the text. Therefore, the value of the position “i” is larger than the number of characters “n”.
図22は、位置「i」の値が文字数「n」より大きくなった後の要約トライと圧縮済テキストの例を示す図である。位置「i」の値が文字数「n」より大きくなると、要約トライ50の構築処理は終了する。そして、ノードポインタ「P」で示されるノード57の符号が圧縮済テキスト60に書き出される。その結果、圧縮済テキスト60は「C=1235346」となる。
FIG. 22 is a diagram illustrating an example of the summary trie and the compressed text after the value of the position “i” is larger than the number of characters “n”. When the value of the position “i” becomes larger than the number of characters “n”, the construction process of the summary trie 50 ends. Then, the code of the
このようにして、未圧縮テキストデータに基づいて、要約トライ50と圧縮済テキスト60とが作成される。第2の実施の形態に示したテキスト符号化技術を用いると、STVFのような接尾辞木の作成が不要となる。接尾辞木は、すべてのテキストデータを読み込んで作成されるため、構築に時間がかかる。そのため第2の実施の形態に示したテキスト符号化技術は、接尾辞木を作成せずに済むことにより、STVFより20倍ほど高速に符号化を行うことができる。 In this way, the summary trie 50 and the compressed text 60 are created based on the uncompressed text data. When the text encoding technique shown in the second embodiment is used, it becomes unnecessary to create a suffix tree like STVF. Since the suffix tree is created by reading all text data, it takes time to construct. Therefore, the text encoding technique shown in the second embodiment can perform encoding about 20 times faster than STVF by eliminating the need to create a suffix tree.
しかも、第2の実施の形態に示したテキスト符号化技術では、テキスト内の文字を先頭から1文字ずつ読み込んで、逐次処理(ストリーム処理)が可能である。逐次処理ができれば、例えば、コンピュータ間の通信における送信データの符号化に利用できる。すなわち、STVFのようにすべてのテキストデータから接尾辞木を構築し、その接尾辞木から文節木を作成後にテキストデータの符号化を行う場合、送信データの全体を読み込むまで、符号化されたデータを作成できない。そのため、ストリーム処理が困難となる。一方、第2の実施の形態に示したテキスト符号化技術では、送信データの先頭から順に符号化することができ、符号化したデータを順次送信できる。これにより、符号化による通信遅延を最小限に抑えることができる。 Moreover, in the text encoding technique shown in the second embodiment, characters in the text can be read one by one from the beginning and sequentially processed (stream processing). If sequential processing can be performed, for example, it can be used for encoding transmission data in communication between computers. That is, when a suffix tree is constructed from all text data as in STVF, and text data is encoded after creating a phrase tree from the suffix tree, the encoded data is read until the entire transmission data is read. Cannot be created. Therefore, stream processing becomes difficult. On the other hand, in the text encoding technique shown in the second embodiment, encoding can be performed sequentially from the top of transmission data, and encoded data can be transmitted sequentially. Thereby, the communication delay by encoding can be suppressed to the minimum.
〔第3の実施の形態〕
第3の実施の形態は、複数の未圧縮テキストを圧縮し、文字検索の対象とすることができるようにしたものである。
[Third Embodiment]
In the third embodiment, a plurality of uncompressed texts can be compressed and used as a character search target.
図23は、第3の実施の形態に係るサーバの機能を示す図である。第3の実施の形態にかかるサーバ100aは、符号化辞書記憶部110a、圧縮済テキスト記憶部120a、テキスト符号化部130a、検索部140a、および解凍部150aを有する。
FIG. 23 is a diagram illustrating functions of a server according to the third embodiment. The
符号化辞書記憶部110aと圧縮済テキスト記憶部120aとは、それぞれ図6に示した第2の実施の形態の同名の要素と同じ機能を有する。
テキスト符号化部130aは、図6に示した第2の実施の形態のテキスト符号化部130が有する機能に加え、複数の未圧縮テキスト71,72,73を区別するための制御記号を圧縮済テキスト80に挿入する機能を有する。制御記号としては、要約トライで割り当てる符号と重複しない記号を用いる。例えば、図23の例では、圧縮済テキスト80内に、未圧縮テキスト71〜73の区切りを示す制御記号として「$」が挿入されている。
The encoding
The
検索部140aは、図6に示した第2の実施の形態の検索部140が有する機能に加え、検索結果内に、ヒットした文字列を含む未圧縮テキストを示す情報を含める機能を有する。例えば、圧縮済テキスト80内での順番によって、ヒットした文字列を含む未圧縮テキストが示される。例えば、検索部140aは、検索でヒットした文字列の位置よりも前にある制御記号「$」の数を数え、その数に1を加算した番号を、該当文字列を含む未圧縮テキストの順番として、検索結果42に含める。
The
解凍部150aは、図6に示した第2の実施の形態の解凍部150が有する機能に加え、未圧縮テキストの順番を指定した解凍要求43を受け取った場合、圧縮済テキスト80内の指定された順番の符号語列を解凍する機能を有する。例えば解凍部150aは、圧縮済テキスト80を、制御記号を境界として分割し、複数の符号語列を生成する。そして解凍部150aは、圧縮済テキスト80の先頭からの符号語列の順番を数え、要求された順番の符号語列を解凍し、解凍済テキスト44とする。
When the
図24は、第3の実施の形態に係るテキスト符号化部の詳細機能を示すブロック図である。テキスト符号化部130aは、頻度閾値記憶部131a、最大符号数記憶部132a、文字選択部133a、ノード作成部134a、頻度カウント部135a、符号出力部136a、および制御記号出力部137を有する。頻度閾値記憶部131a、最大符号数記憶部132a、文字選択部133a、ノード作成部134a、頻度カウント部135a、および符号出力部136aは、図7に示した第2の実施の形態における同名の要素と同じ機能を有している。
FIG. 24 is a block diagram illustrating detailed functions of the text encoding unit according to the third embodiment. The
制御記号出力部137は、符号出力部136aが圧縮済テキスト記憶部120aに対して、1つの未圧縮テキストから生成した最後の符号(図8のステップS20で格納される符号)を出力したことを検出する。そして、制御記号出力部137は、1つの未圧縮テキストの末尾(最後の符号の後)に制御記号「$」を格納する。
The control
次に、テキスト符号化処理の手順について詳細に説明する。なお、テキスト符号化処理の入力は、テキスト数M個(Mは1以上の整数)の未圧縮テキスト71,72,73、閾値、および最大符号数である。ここでM個の未圧縮テキスト71,72,73,・・・それぞれに含まれるテキストデータ列を、T1,・・・,TMとする。また、現在処理対象としている未圧縮テキストを識別するテキスト番号を「m」(mは1以上の整数)とする。また、テキスト間の境界を示す制御記号を「$」とする。その他の記号の意味は第2の実施の形態と同様である。
Next, the procedure of the text encoding process will be described in detail. Note that the input of the text encoding process is the
図25は、第3の実施の形態に係るテキスト符号化処理の手順を示すフローチャートである。以下、図25に示す処理をステップ番号に沿って説明する。
[ステップS41]サーバ100a内の各要素は、それぞれ情報の初期化を行う。例えば文字選択部133aは、文字の位置「i」の値を「0」に初期化する。また文字選択部133aは、テキスト番号「m」の値を「1」に初期化する。
FIG. 25 is a flowchart illustrating the procedure of the text encoding process according to the third embodiment. In the following, the process illustrated in FIG. 25 will be described in order of step number.
[Step S41] Each element in the
ノード作成部134aは、符号化辞書記憶部110a内の要約トライ「D」を初期化する。さらにノード作成部134aは、ノードポインタ「P」を初期化する。符号出力部136aは、圧縮済テキスト記憶部120a内の圧縮済テキストを初期化する。初期化された圧縮済テキストには、空文字列が設定され、「C=ε」と表される。εは空文字列を意味する。
The
[ステップS42]文字選択部133aは、テキスト番号「m」がテキスト数「M」とより大きいか否かを判断する。テキスト番号がテキスト数より大きい場合、処理が終了する。テキスト番号がテキスト数以下であれば、処理がステップS43に進められる。
[Step S42] The
[ステップS43]文字選択部133aは、「m」番目のテキストデータ「Tm」を取得する。
[ステップS44]文字選択部133aは、位置「i」の値に「1」を設定する(i=1)。これにより、「m」番目のテキストデータ「Tm」の先頭の文字が処理対象となる。
[Step S43] The
[Step S44] The
[ステップS45]文字選択部133aは、テキストデータ「Tm」の長さ(文字数)を、文字数「n」に代入する。
[ステップS46]文字選択部133a、ノード作成部134a、頻度カウント部135a、および符号出力部136の連携した処理により、圧縮処理が行われる。この処理の詳細は後述する(図26参照)。
[Step S45] The
[Step S46] The compression processing is performed by the cooperation of the
[ステップS47]制御記号出力部137は、制御記号「$」を圧縮済テキスト「C」の末尾に書き出す。
[ステップS48]ノード作成部134aは、ノードポインタ「P」を初期化する(P=root(D))。
[Step S47] The control
[Step S48] The
[ステップS49]文字選択部133aは、テキスト番号「m」に1を加算する。その後、処理がステップS42に進められる。
図26は、圧縮処理の詳細手順を示すフローチャートである。以下、図26に示す処理をステップ番号に沿って説明する。
[Step S49] The
FIG. 26 is a flowchart showing a detailed procedure of the compression process. In the following, the process illustrated in FIG. 26 will be described in order of step number.
[ステップS51]ノード作成部134aは、位置「i」の値が、文字数「n」より大きいか否かを判断する。位置「i」の値が文字数「n」より大きければ、処理がステップS58に進められる。位置「i」の値が文字数「n」以下であれば、処理がステップS52に進められる。
[Step S51] The
[ステップS52]位置「i」の値が文字数「n」以下であれば、ノード作成部134a、頻度カウント部135a、および符号出力部136aが連携し、要約トライ作成およびテキスト圧縮処理を実行する。この処理の詳細は、図9に示した第2の実施の形態における要約トライ作成およびテキスト圧縮処理と同様である。
[Step S52] If the value of the position “i” is equal to or less than the number of characters “n”, the
[ステップS53]文字選択部133aは、位置「i」の値をインクリメントする(i=i+1)。これにより、テキスト番号「m」の未圧縮テキスト内の次の文字が処理対象となる。
[Step S53] The
[ステップS54]ノード作成部134aは、要約トライ「D」の大きさ「k」が、最大符号数「K」未満か否かを判断する。要約トライ「D」の大きさ「k」が最大符号数「K」未満であれば、処理がステップS51に進められる。要約トライ「D」の大きさ「k」が最大符号数「K」以上であれば、処理がステップS55に進められる。
[Step S54] The
[ステップS55]ノード作成部134aは、位置「i」の値が、文字数「n」より大きいか否かを判断する。位置「i」の値が文字数「n」より大きければ、処理がステップS58に進められる。位置「i」の値が文字数「n」以下であれば、処理がステップS56に進められる。
[Step S55] The
[ステップS56]位置「i」の値が文字数「n」以下であれば、符号出力部136aは、テキスト圧縮処理を実行する。この処理の詳細は、図10に示した第2の実施の形態におけるテキスト圧縮処理と同様である。
[Step S56] If the value of the position “i” is equal to or less than the number of characters “n”, the
[ステップS57]文字選択部133aは、位置「i」の値をインクリメントする(i=i+1)。これにより、テキスト番号「m」の未圧縮テキスト内の次の文字が処理対象となる。その後、処理がステップS55に進められる。
[Step S57] The
[ステップS58]位置「i」の値が文字数「n」より大きくなると、符号出力部136は、ノードポインタ「P」が示すノードの符号を、圧縮済テキスト「C」の末尾に書き出す。その後、圧縮処理が終了し、処理が図25のステップS47に進められる。
[Step S58] When the value of the position “i” becomes larger than the number of characters “n”, the
このようにして、符号化された個々のテキストデータの間に制御記号を挿入することができる。この制御記号により、圧縮済テキスト内の符号語列を、符号の生成元となった未圧縮テキストごとに分割することができる。そして、圧縮済テキスト内の分割された符号語列の順番により、各符号語列の生成元となった未圧縮テキストを判別できる。 In this way, control symbols can be inserted between encoded individual text data. With this control symbol, the code word string in the compressed text can be divided for each uncompressed text from which the code is generated. And the uncompressed text which became the production | generation origin of each codeword sequence can be discriminate | determined by the order of the codeword sequence divided | segmented in the compressed text.
〔第4の実施の形態〕
第4の実施の形態は、要約トライに含まれるノードの閾値「α」を動的に変更可能としたものである。要約トライを用いた符号化では、閾値「α」のとり方によって圧縮率が大きく異なる。閾値「α」が大きすぎると、要約トライがなかなか成長せず、長い文字列に符号を割り当てることができない。逆に閾値「α」が小さすぎると、要約トライが早く成長しすぎ、後方のデータを読む前に最大サイズを超えてしまう。そこで第4の実施の形態では、閾値テーブルを用いて、最初のうちは閾値「α」の値を小さく保ち、読み込むデータ量が増えるのに伴い閾値「α」を徐々に大きくしていく。
[Fourth Embodiment]
In the fourth embodiment, the threshold value “α” of a node included in the summary trie can be dynamically changed. In encoding using summary trie, the compression rate varies greatly depending on how the threshold value “α” is set. If the threshold “α” is too large, the summary trie does not grow easily, and a code cannot be assigned to a long character string. Conversely, if the threshold “α” is too small, the summary trie grows too quickly and exceeds the maximum size before reading back data. Therefore, in the fourth embodiment, using the threshold value table, the threshold value “α” is initially kept small, and the threshold value “α” is gradually increased as the amount of data to be read increases.
図27は、第4の実施の形態に係るテキスト符号化部の機能を示すブロック図である。テキスト符号化部130bは、未圧縮テキスト40を符号化し、要約トライと圧縮済テキストとを生成する。要約トライは、符号化辞書として符号化辞書記憶部110bに格納される。圧縮済テキストは、圧縮済テキスト記憶部120bに格納される。符号化辞書記憶部110bは、要約トライ形式の符号化辞書を記憶する。圧縮済テキスト記憶部120bは、圧縮済テキストを記憶する。
FIG. 27 is a block diagram illustrating functions of the text encoding unit according to the fourth embodiment. The
テキスト符号化部130bは、頻度閾値記憶部131b、最大符号数記憶部132b、文字選択部133b、ノード作成部134b、頻度カウント部135b、符号出力部136b、閾値テーブル記憶部138、および閾値設定部139を有する。頻度閾値記憶部131b、最大符号数記憶部132b、文字選択部133b、ノード作成部134b、頻度カウント部135b、および符号出力部136bは、図7に示した第2の実施の形態における同名の要素と同じ機能を有している。
The
閾値テーブル記憶部138は、符号化された文字数と閾値との対応関係を示す閾値テーブルを記憶する。例えば、RAM102またはHDD103の記憶領域の一部が、閾値テーブル記憶部138として使用される。
The threshold value
閾値設定部139は、文字選択部133bが選択してノード作成部134bに渡した文字数に応じて、頻度閾値記憶部131b内の閾値を設定する。その際、閾値設定部139は、閾値テーブル記憶部138を参照し、設定する閾値を決定する。
The
図28は、閾値テーブル記憶部のデータ構造の一例を示す図である。閾値テーブル記憶部138には、閾値テーブル138aが格納されている。閾値テーブル138aには、文字数と閾値との欄が設けられている。閾値テーブル138a内の横方向に並べられた情報が互いに関連付けられている。
FIG. 28 is a diagram illustrating an example of a data structure of the threshold table storage unit. The threshold value
文字数の欄には、符号化された文字の数を示す数値の範囲が設定されている。図28の例では、文字のデータ量を示すバイト数によって、文字数が示されている。例えば1バイト文字であれば、バイト数の数値が、そのまま文字数となる。また2バイト文字であれば、バイト数の数値の半分の値が、文字数となる。 A numerical value range indicating the number of encoded characters is set in the number of characters column. In the example of FIG. 28, the number of characters is indicated by the number of bytes indicating the amount of character data. For example, if it is a 1-byte character, the numerical value of the number of bytes becomes the number of characters as it is. If it is a 2-byte character, the number of characters is half the number of bytes.
閾値の欄には、対応する文字数の範囲内の文字が符号化されたときの閾値が設定されている。例えば、符号化された文字のデータ量が1バイトから1Kバイト範囲内であれば、閾値「α」として10が設定される。また符号化された文字のデータ量が1Kバイトから100Kバイト範囲内であれば、閾値「α」として100が設定される。なお、文字のデータ量が「1〜1K」と「1K〜100K」の境界の値「1K」となった場合、例えば値が大きい方の閾値(この例では「100」)が設定される。 In the threshold value column, a threshold value when characters within the range of the corresponding number of characters are encoded is set. For example, if the data amount of the encoded character is within the range of 1 byte to 1 Kbyte, 10 is set as the threshold “α”. If the encoded character data amount is within the range of 1 Kbytes to 100 Kbytes, 100 is set as the threshold “α”. When the character data amount reaches the value “1K” at the boundary between “1 to 1K” and “1K to 100K”, for example, a threshold having a larger value (“100” in this example) is set.
図29は、第4の実施の形態に係るテキスト符号化処理の手順を示すフローチャートである。以下、図29に示す処理をステップ番号に沿って説明する。
[ステップS61]テキスト符号化部130b内の各要素は、それぞれ情報の初期化を行う。例えば文字選択部133bは、文字の位置「i」の値を「0」に初期化する。ノード作成部134bは、符号化辞書記憶部110b内の要約トライ「D」を初期化する。さらにノード作成部134bは、ノードポインタ「P」を初期化する。符号出力部136bは、圧縮済テキスト記憶部120b内の圧縮済テキストを初期化する。
FIG. 29 is a flowchart showing the procedure of the text encoding process according to the fourth embodiment. In the following, the process illustrated in FIG. 29 will be described in order of step number.
[Step S61] Each element in the
[ステップS62]文字選択部133bは、位置「i」の値をインクリメントする(i=i+1)。これにより、未圧縮テキスト40内の1文字目が処理対象となる。
[ステップS63]ノード作成部134bは、位置「i」の値が、文字数「n」より大きいか否かを判断する。位置「i」の値が文字数「n」より大きければ、処理がステップS71に進められる。位置「i」の値が文字数「n」以下であれば、処理がステップS64に進められる。
[Step S62] The
[Step S63] The
[ステップS64]閾値設定部139は、閾値テーブル138aと位置「i」に基づいて閾値「α」を求める。例えば閾値設定部139は、未圧縮テキスト40に含まれる文字が1バイト文字であれば、位置「i」の値を、符号化した文字数に応じたバイト数として取得する。次に閾値設定部139は、取得したバイト数を含む範囲を、閾値テーブル138aの文字数の欄から選択する。さらに閾値設定部139は、選択した範囲に対応する閾値を、閾値テーブル138aから取得する。そして閾値設定部139は、取得した閾値を頻度閾値記憶部131bに格納する。
[Step S64] The threshold
[ステップS65]位置「i」の値が文字数「n」以下であれば、ノード作成部134b、頻度カウント部135b、および符号出力部136bが連携し、要約トライ作成およびテキスト圧縮処理を実行する。この処理の詳細は、図9に示した第2の実施の形態の処理と同様である。
[Step S65] If the value of the position “i” is equal to or less than the number of characters “n”, the
[ステップS66]文字選択部133bは、位置「i」の値をインクリメントする(i=i+1)。これにより、未圧縮テキスト40内の次の文字が処理対象となる。
[ステップS67]ノード作成部134bは、要約トライ「D」の大きさ「k」が、最大符号数「K」未満か否かを判断する。要約トライ「D」の大きさ「k」が最大符号数「K」未満であれば、処理がステップS63に進められる。要約トライ「D」の大きさ「k」が最大符号数「K」以上であれば、処理がステップS68に進められる。
[Step S66] The
[Step S67] The
[ステップS68]ノード作成部134bは、位置「i」の値が、文字数「n」より大きいか否かを判断する。位置「i」の値が文字数「n」より大きければ、処理がステップS71に進められる。位置「i」の値が文字数「n」以下であれば、処理がステップS69に進められる。
[Step S68] The
[ステップS69]位置「i」の値が文字数「n」以下であれば、符号出力部136bは、テキスト圧縮処理を実行する。この処理の詳細は、図10に示した第2の実施の形態の処理と同様である。
[Step S69] If the value of the position “i” is equal to or less than the number of characters “n”, the
[ステップS70]文字選択部133bは、位置「i」の値をインクリメントする(i=i+1)。これにより、未圧縮テキスト40内の次の文字が処理対象となる。その後、処理がステップS68に進められる。
[Step S70] The
[ステップS71]位置「i」の値が文字数「n」より大きくなると、符号出力部136bは、ノードポインタ「P」が示すノードの符号を、圧縮済テキスト「C」の末尾に書き出す。その後、処理が終了する。
[Step S71] When the value of the position “i” becomes larger than the number of characters “n”, the
このようにして、閾値「α」を動的に変更することができる。これにより、システムを運用していくうちに符号化された文字数が徐々に増加していっても、符号化された文字数に応じた適切な閾値「α」が設定される。例えば、閾値「α」の値を、符号化された文字数の増加に伴い徐々に大きくしていくことで、閾値「α」が大きすぎることにより、要約トライがなかなか成長しないような事態を抑止できる。また閾値「α」が小さすぎることにより、要約トライが早く成長しすぎ、後方のデータを読む前にノード数が最大符号数を超えてしまう事態の発生も抑止できる。 In this way, the threshold “α” can be dynamically changed. Thereby, even if the number of encoded characters gradually increases as the system is operated, an appropriate threshold “α” corresponding to the number of encoded characters is set. For example, by gradually increasing the value of the threshold “α” as the number of encoded characters increases, it is possible to suppress a situation where the summary “try” does not grow easily due to the threshold “α” being too large. . In addition, since the threshold “α” is too small, it is possible to suppress a situation in which the summary trie grows too quickly and the number of nodes exceeds the maximum number of codes before reading back data.
〔その他の応用例〕
上記の処理機能は、コンピュータによって実現することができる。その場合、サーバが有すべき機能の処理内容を記述したプログラムが提供される。そのプログラムをコンピュータで実行することにより、上記処理機能がコンピュータ上で実現される。処理内容を記述したプログラムは、コンピュータで読み取り可能な記録媒体に記録しておくことができる。コンピュータで読み取り可能な記録媒体としては、磁気記憶装置、光ディスク、光磁気記録媒体、半導体メモリなどがある。磁気記憶装置には、ハードディスク装置(HDD)、フレキシブルディスク(FD)、磁気テープなどがある。光ディスクには、DVD、DVD−RAM、CD−ROM/RWなどがある。光磁気記録媒体には、MO(Magneto-Optical disc)などがある。
[Other application examples]
The above processing functions can be realized by a computer. In that case, a program describing the processing contents of the functions that the server should have is provided. By executing the program on a computer, the above processing functions are realized on the computer. The program describing the processing contents can be recorded on a computer-readable recording medium. Examples of the computer-readable recording medium include a magnetic storage device, an optical disk, a magneto-optical recording medium, and a semiconductor memory. Examples of the magnetic storage device include a hard disk device (HDD), a flexible disk (FD), and a magnetic tape. Optical discs include DVD, DVD-RAM, CD-ROM / RW, and the like. Magneto-optical recording media include MO (Magneto-Optical disc).
プログラムを流通させる場合には、例えば、そのプログラムが記録されたDVD、CD−ROMなどの可搬型記録媒体が販売される。また、プログラムをサーバコンピュータの記憶装置に格納しておき、ネットワークを介して、サーバコンピュータから他のコンピュータにそのプログラムを転送することもできる。 When distributing the program, for example, a portable recording medium such as a DVD or a CD-ROM in which the program is recorded is sold. It is also possible to store the program in a storage device of a server computer and transfer the program from the server computer to another computer via a network.
プログラムを実行するコンピュータは、例えば、可搬型記録媒体に記録されたプログラムもしくはサーバコンピュータから転送されたプログラムを、自己の記憶装置に格納する。そして、コンピュータは、自己の記憶装置からプログラムを読み取り、プログラムに従った処理を実行する。なお、コンピュータは、可搬型記録媒体から直接プログラムを読み取り、そのプログラムに従った処理を実行することもできる。また、コンピュータは、サーバコンピュータからプログラムが転送されるごとに、逐次、受け取ったプログラムに従った処理を実行することもできる。 The computer that executes the program stores, for example, the program recorded on the portable recording medium or the program transferred from the server computer in its own storage device. Then, the computer reads the program from its own storage device and executes processing according to the program. The computer can also read the program directly from the portable recording medium and execute processing according to the program. Further, each time the program is transferred from the server computer, the computer can sequentially execute processing according to the received program.
また、上記の処理機能の少なくとも一部を、DSP(Digital Signal Processor)、ASIC(Application Specific Integrated Circuit)、PLD(Programmable Logic Device)などの電子回路で実現することもできる。 In addition, at least a part of the above processing functions can be realized by an electronic circuit such as a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), or a PLD (Programmable Logic Device).
以上、実施の形態を例示したが、実施の形態で示した各部の構成は同様の機能を有する他のものに置換することができる。また、他の任意の構成物や工程が付加されてもよい。さらに、前述した実施の形態のうちの任意の2以上の構成(特徴)を組み合わせたものであってもよい。 As mentioned above, although embodiment was illustrated, the structure of each part shown by embodiment can be substituted by the other thing which has the same function. Moreover, other arbitrary structures and processes may be added. Further, any two or more configurations (features) of the above-described embodiments may be combined.
以上の実施の形態に開示された技術には、以下の付記に示す技術が含まれる。
(付記1) テキストデータ内の文字列から順に文字を選択する文字選択手段と、
前記テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照し、前記ルートのノードから前記判断位置を開始し、前記判断位置のノードに対して前記文字選択手段で選択された文字に対応する子のノードが存在する場合、該子のノードに前記判断位置を移動し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達していない場合、前記ルートのノードに対する前記選択された文字に対応する子のノードに前記判断位置を移動し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達している場合、前記判断位置のノードに対して、新たな識別子を付与した、前記選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに前記判断位置を移動するノード追加手段と、
前記文節木記憶手段を参照し、前記判断位置のノードに対して前記選択された文字に対応するノードが存在しない場合、前記判断位置のノードの付与された前記選択された文字の出現回数をカウントアップする頻度カウント手段と、
を有することを特徴とするテキスト処理装置。
The techniques disclosed in the above embodiments include the techniques shown in the following supplementary notes.
(Supplementary Note 1) Character selection means for selecting characters in order from a character string in text data;
A plurality of nodes corresponding to characters that can appear in the text data are associated in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data can be added to each node. Refers to the phrase tree storage means for storing the phrase tree associated with each node and assigned with the node identifier and the number of times each character appears next when each node is determined. The determination position is started from the node of the root, and when there is a child node corresponding to the character selected by the character selection unit with respect to the node of the determination position, the determination position is included in the child node. , The child node corresponding to the selected character does not exist with respect to the node at the determination position, and the appearance number of the selected character given to the node at the determination position is Is not reached the predetermined threshold, the determination position is moved to a child node corresponding to the selected character for the root node, and the selected character is corresponding to the determination position node. If there is no child node and the number of appearances of the selected character given to the node at the judgment position has reached a predetermined threshold, a new identifier is given to the node at the judgment position Node adding means for adding a child node corresponding to the selected character and moving the determination position to the added child node;
If the node corresponding to the selected character does not exist with respect to the node at the determination position with reference to the phrase tree storage unit, the number of appearances of the selected character to which the node at the determination position is added is counted. Frequency counting means to increase,
A text processing apparatus comprising:
(付記2) 前記文節木記憶手段を参照し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在しない場合、前記判断位置のノードに付与された識別子を出力する識別子出力手段をさらに有することを特徴とする付記1記載のテキスト処理装置。
(Supplementary Note 2) With reference to the phrase tree storage means, if there is no child node corresponding to the selected character with respect to the node at the determination position, an identifier assigned to the node at the determination position is output. The text processing apparatus according to
(付記3) 前記識別子出力手段は、前記テキストデータ内の文字列の最後の文字が選択されたことにより前記判断位置が移動されると、移動後の前記判断位置のノードに付与された識別子を出力することを特徴とする付記2記載のテキスト処理装置。
(Supplementary Note 3) When the determination position is moved by selecting the last character of the character string in the text data, the identifier output means displays the identifier assigned to the node of the determination position after the movement. The text processing device according to
(付記4) 前記ノード追加手段は、子のノードの追加を、前記文節木のノードの数が所定数に達するまで行うことを特徴とする付記1乃至3のいずれかに記載のテキスト処理装置。
(Supplementary note 4) The text processing apparatus according to any one of
(付記5) 前記選択された文字の総量に応じて前記閾値を変更する閾値変更手段をさらに有することを特徴とする付記1乃至4のいずれかに記載のテキスト処理装置。
(付記6) 前記閾値変更手段は、前記選択された文字の総量が増加するほど、前記閾値の値を大きくすることを特徴とする付記5記載のテキスト処理装置。
(Supplementary note 5) The text processing device according to any one of
(Additional remark 6) The said threshold value change means enlarges the value of the said threshold value, so that the total amount of the said selected character increases, The text processing apparatus of
(付記7) 移動後の前記判断位置のノードに付与された識別子を出力後、前記テキストデータ内の文字列に対応する符号の最後であることを示す制御記号を出力する制御記号出力手段をさらに有することを特徴とする付記3記載のテキスト処理装置。
(Additional remark 7) The control symbol output means which outputs the control symbol which shows that it is the last of the code | cord | chord corresponding to the character string in the said text data after outputting the identifier provided to the node of the said judgment position after movement is further provided The text processing device according to
(付記8) コンピュータが、
テキストデータ内の文字列から順に文字を選択し、
前記テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照し、
前記ルートのノードから前記判断位置を開始し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在する場合、該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達していない場合、前記ルートのノードに対する前記選択された文字に対応する子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達している場合、前記判断位置のノードに対して、新たな識別子を付与した、前記選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応するノードが存在しない場合、前記判断位置のノードの付与された前記選択された文字の出現回数をカウントアップする、
ことを特徴とするテキスト処理方法。
(Appendix 8) The computer
Select characters in order from the character string in the text data,
A plurality of nodes corresponding to characters that can appear in the text data are associated in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data can be added to each node. Refers to the phrase tree storage means for storing the phrase tree associated with each node and assigned with the node identifier and the number of times each character appears next when each node is determined. And
Start the decision position from the node of the route;
If there is a child node corresponding to the selected character with respect to the node at the determination position, the determination position is moved to the child node;
There is no child node corresponding to the selected character for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position does not reach a predetermined threshold value. The determination position is moved to a child node corresponding to the selected character for the root node, and
There is no child node corresponding to the selected character with respect to the node at the determination position, and the number of appearances of the selected character given to the node at the determination position has reached a predetermined threshold value. In this case, a child node corresponding to the selected character with a new identifier is added to the node at the determination position, and the determination position is moved to the added child node.
When there is no node corresponding to the selected character with respect to the node at the determination position, the number of appearances of the selected character to which the node at the determination position is given is counted up.
A text processing method characterized by the above.
(付記9) 前記コンピュータが、さらに、
前記文節木記憶手段を参照し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在しない場合、前記判断位置のノードに付与された識別子を出力することを特徴とする付記8記載のテキスト処理方法。
(Supplementary Note 9) The computer further includes:
The phrase tree storage means is referred to, and when there is no child node corresponding to the selected character for the node at the determination position, an identifier given to the node at the determination position is output. The text processing method according to
(付記10) 前記コンピュータが、さらに、
前記テキストデータ内の文字列の最後の文字が選択されたことにより前記判断位置が移動されると、移動後の前記判断位置のノードに付与された識別子を出力することを特徴とする付記9記載のテキスト処理方法。
(Supplementary Note 10) The computer further includes:
The
(付記11) 子のノードの追加は、前記文節木のノードの数が所定数に達するまで行うことを特徴とする付記8乃至10のいずれかに記載のテキスト処理方法。
(付記12) 前記コンピュータが、さらに、
前記選択された文字の総量に応じて前記閾値を変更することを特徴とする付記8乃至11のいずれかに記載のテキスト処理方法。
(Supplementary note 11) The text processing method according to any one of
(Supplementary Note 12) The computer further includes:
12. The text processing method according to any one of
(付記13) 前記閾値を変更する際には、前記選択された文字の総量が増加するほど、前記閾値の値を大きくすることを特徴とする付記12記載のテキスト処理方法。
(付記14) 前記コンピュータが、さらに、
移動後の前記判断位置のノードに付与された識別子を出力後、前記テキストデータ内の文字列に対応する符号の最後であることを示す制御記号を出力することを特徴とする付記10記載のテキスト処理方法。
(Additional remark 13) When changing the said threshold value, the value of the said threshold value is enlarged, so that the total amount of the said selected character increases, The text processing method of
(Supplementary Note 14) The computer further includes:
11. The text according to
(付記15) コンピュータに、
テキストデータ内の文字列から順に文字を選択し、
前記テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照し、
前記ルートのノードから前記判断位置を開始し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在する場合、該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達していない場合、前記ルートのノードに対する前記選択された文字に対応する子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達している場合、前記判断位置のノードに対して、新たな識別子を付与した、前記選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応するノードが存在しない場合、前記判断位置のノードの付与された前記選択された文字の出現回数をカウントアップする、
処理を実行させることを特徴とするテキスト処理プログラム。
(Supplementary note 15)
Select characters in order from the character string in the text data,
A plurality of nodes corresponding to characters that can appear in the text data are associated in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data can be added to each node. Refers to the phrase tree storage means for storing the phrase tree associated with each node and assigned with the node identifier and the number of times each character appears next when each node is determined. And
Start the decision position from the node of the route;
If there is a child node corresponding to the selected character with respect to the node at the determination position, the determination position is moved to the child node;
There is no child node corresponding to the selected character for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position does not reach a predetermined threshold value. The determination position is moved to a child node corresponding to the selected character for the root node, and
There is no child node corresponding to the selected character with respect to the node at the determination position, and the number of appearances of the selected character given to the node at the determination position has reached a predetermined threshold value. In this case, a child node corresponding to the selected character with a new identifier is added to the node at the determination position, and the determination position is moved to the added child node.
When there is no node corresponding to the selected character with respect to the node at the determination position, the number of appearances of the selected character to which the node at the determination position is given is counted up.
A text processing program for executing a process.
(付記16) 前記コンピュータが、さらに、
前記文節木記憶手段を参照し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在しない場合、前記判断位置のノードに付与された識別子を出力することを特徴とする付記15記載のテキスト処理プログラム。
(Supplementary Note 16) The computer further includes:
The phrase tree storage means is referred to, and when there is no child node corresponding to the selected character for the node at the determination position, an identifier given to the node at the determination position is output. The text processing program according to appendix 15.
(付記17) 前記コンピュータが、さらに、
前記テキストデータ内の文字列の最後の文字が選択されたことにより前記判断位置が移動されると、移動後の前記判断位置のノードに付与された識別子を出力することを特徴とする付記16記載のテキスト処理プログラム。
(Supplementary Note 17) The computer further includes:
The supplementary note 16, wherein when the determination position is moved by selecting the last character of the character string in the text data, an identifier given to the node of the determination position after the movement is output. Text processing program.
(付記18) 子節点の追加は、前記文節木のノードの数が所定数に達するまで行うことを特徴とする付記15乃至17のいずれかに記載のテキスト処理プログラム。
(付記19) 前記コンピュータが、さらに、
前記選択された文字の総量に応じて前記閾値を変更することを特徴とする付記15乃至18のいずれかに記載のテキスト処理プログラム。
(Supplementary note 18) The text processing program according to any one of supplementary notes 15 to 17, wherein the child nodes are added until the number of nodes of the phrase tree reaches a predetermined number.
(Supplementary note 19) The computer further includes:
The text processing program according to any one of appendices 15 to 18, wherein the threshold value is changed according to the total amount of the selected characters.
(付記20) 前記閾値を変更する際には、前記選択された文字の総量が増加するほど、前記閾値の値を大きくすることを特徴とする付記19記載のテキスト処理プログラム。
(付記21) 前記コンピュータが、さらに、
移動後の前記判断位置のノードに付与された識別子を出力後、前記テキストデータ内の文字列に対応する符号の最後であることを示す制御記号を出力することを特徴とする付記17記載のテキスト処理プログラム。
(Supplementary note 20) The text processing program according to supplementary note 19, wherein when the threshold value is changed, the threshold value is increased as the total amount of the selected characters increases.
(Supplementary Note 21) The computer further includes:
18. The text according to claim 17, wherein after the identifier assigned to the node at the determined position after movement is output, a control symbol indicating the end of the code corresponding to the character string in the text data is output. Processing program.
1 テキスト処理装置
1a 文字選択手段
1b ノード追加手段
1c 頻度カウント手段
1d 識別子出力手段
2 文節木記憶手段
2a 文節木
3 テキストデータ
4 符号語列
DESCRIPTION OF
Claims (7)
前記テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照し、前記ルートのノードから前記判断位置を開始し、前記判断位置のノードに対して前記文字選択手段で選択された文字に対応する子のノードが存在する場合、該子のノードに前記判断位置を移動し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達していない場合、前記ルートのノードに対する前記選択された文字に対応する子のノードに前記判断位置を移動し、前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達している場合、前記判断位置のノードに対して、新たな識別子を付与した、前記選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに前記判断位置を移動するノード追加手段と、
前記文節木記憶手段を参照し、前記判断位置のノードに対して前記選択された文字に対応するノードが存在しない場合、前記判断位置のノードの付与された前記選択された文字の出現回数をカウントアップする頻度カウント手段と、
を有することを特徴とするテキスト処理装置。 A character selection means for selecting characters in order from the character string in the text data;
A plurality of nodes corresponding to characters that can appear in the text data are associated in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data can be added to each node. Refers to the phrase tree storage means for storing the phrase tree associated with each node and assigned with the node identifier and the number of times each character appears next when each node is determined. The determination position is started from the node of the root, and when there is a child node corresponding to the character selected by the character selection unit with respect to the node of the determination position, the determination position is included in the child node. , The child node corresponding to the selected character does not exist with respect to the node at the determination position, and the appearance number of the selected character given to the node at the determination position is Is not reached the predetermined threshold, the determination position is moved to a child node corresponding to the selected character for the root node, and the selected character is corresponding to the determination position node. If there is no child node and the number of appearances of the selected character given to the node at the judgment position has reached a predetermined threshold, a new identifier is given to the node at the judgment position Node adding means for adding a child node corresponding to the selected character and moving the determination position to the added child node;
If the node corresponding to the selected character does not exist with respect to the node at the determination position with reference to the phrase tree storage unit, the number of appearances of the selected character to which the node at the determination position is added is counted. Frequency counting means to increase,
A text processing apparatus comprising:
テキストデータ内の文字列から順に文字を選択し、
前記テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照し、
前記ルートのノードから前記判断位置を開始し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在する場合、該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達していない場合、前記ルートのノードに対する前記選択された文字に対応する子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達している場合、前記判断位置のノードに対して、新たな識別子を付与した、前記選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応するノードが存在しない場合、前記判断位置のノードの付与された前記選択された文字の出現回数をカウントアップする、
ことを特徴とするテキスト処理方法。 Computer
Select characters in order from the character string in the text data,
A plurality of nodes corresponding to characters that can appear in the text data are associated in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data can be added to each node. Refers to the phrase tree storage means for storing the phrase tree associated with each node and assigned with the node identifier and the number of times each character appears next when each node is determined. And
Start the decision position from the node of the route;
If there is a child node corresponding to the selected character with respect to the node at the determination position, the determination position is moved to the child node;
There is no child node corresponding to the selected character for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position does not reach a predetermined threshold value. The determination position is moved to a child node corresponding to the selected character for the root node, and
There is no child node corresponding to the selected character with respect to the node at the determination position, and the number of appearances of the selected character given to the node at the determination position has reached a predetermined threshold value. In this case, a child node corresponding to the selected character with a new identifier is added to the node at the determination position, and the determination position is moved to the added child node.
When there is no node corresponding to the selected character with respect to the node at the determination position, the number of appearances of the selected character to which the node at the determination position is given is counted up.
A text processing method characterized by the above.
テキストデータ内の文字列から順に文字を選択し、
前記テキストデータに出現し得る文字に対応する複数のノードがルートのノードの子として木構造で予め関連付けられ、各ノードに対して前記テキストデータに出現し得る文字に対応する子のノードを追加可能であり、各ノードに対応付けて、ノードの識別子と、各ノードが判断位置とされたときに次に出現した各文字の出現回数とが付与された文節木を記憶する文節木記憶手段を参照し、
前記ルートのノードから前記判断位置を開始し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在する場合、該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達していない場合、前記ルートのノードに対する前記選択された文字に対応する子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応する子のノードが存在せず、かつ前記判断位置のノードに付与された前記選択された文字の出現回数が所定の閾値に達している場合、前記判断位置のノードに対して、新たな識別子を付与した、前記選択された文字に対応する子のノードを追加すると共に、追加した該子のノードに前記判断位置を移動し、
前記判断位置のノードに対して前記選択された文字に対応するノードが存在しない場合、前記判断位置のノードの付与された前記選択された文字の出現回数をカウントアップする、
処理を実行させることを特徴とするテキスト処理プログラム。 On the computer,
Select characters in order from the character string in the text data,
A plurality of nodes corresponding to characters that can appear in the text data are associated in advance in a tree structure as children of the root node, and child nodes corresponding to characters that can appear in the text data can be added to each node. Refers to the phrase tree storage means for storing the phrase tree associated with each node and assigned with the node identifier and the number of times each character appears next when each node is determined. And
Start the decision position from the node of the route;
If there is a child node corresponding to the selected character with respect to the node at the determination position, the determination position is moved to the child node;
There is no child node corresponding to the selected character for the node at the determination position, and the number of appearances of the selected character assigned to the node at the determination position does not reach a predetermined threshold value. The determination position is moved to a child node corresponding to the selected character for the root node, and
There is no child node corresponding to the selected character with respect to the node at the determination position, and the number of appearances of the selected character given to the node at the determination position has reached a predetermined threshold value. In this case, a child node corresponding to the selected character with a new identifier is added to the node at the determination position, and the determination position is moved to the added child node.
When there is no node corresponding to the selected character with respect to the node at the determination position, the number of appearances of the selected character to which the node at the determination position is given is counted up.
A text processing program for executing a process.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010091311A JP5544998B2 (en) | 2010-04-12 | 2010-04-12 | Text processing apparatus, text processing method, and text processing program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010091311A JP5544998B2 (en) | 2010-04-12 | 2010-04-12 | Text processing apparatus, text processing method, and text processing program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2011221845A true JP2011221845A (en) | 2011-11-04 |
JP5544998B2 JP5544998B2 (en) | 2014-07-09 |
Family
ID=45038744
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010091311A Expired - Fee Related JP5544998B2 (en) | 2010-04-12 | 2010-04-12 | Text processing apparatus, text processing method, and text processing program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5544998B2 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014011538A (en) * | 2012-06-28 | 2014-01-20 | Fujitsu Ltd | Program for code processing and data structure |
EP2750053A1 (en) | 2012-12-28 | 2014-07-02 | Fujitsu Limited | Data storage program, data retrieval program, data retrieval apparatus, data storage method and data retrieval method |
JP2016034158A (en) * | 2015-12-07 | 2016-03-10 | 富士通株式会社 | Program for code processing, and data structure |
CN107463676A (en) * | 2017-08-04 | 2017-12-12 | 杭州安恒信息技术有限公司 | Text data store method and device |
CN110262289A (en) * | 2019-07-18 | 2019-09-20 | 潍柴动力股份有限公司 | The processing method of variable, device and storage medium in A2L file |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH06149537A (en) * | 1992-11-05 | 1994-05-27 | Fujitsu Ltd | Data compression method and restoration method |
JP2007011784A (en) * | 2005-06-30 | 2007-01-18 | Fujitsu Ltd | Data sorting program, data sorting method and data sorting processor |
-
2010
- 2010-04-12 JP JP2010091311A patent/JP5544998B2/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH06149537A (en) * | 1992-11-05 | 1994-05-27 | Fujitsu Ltd | Data compression method and restoration method |
JP2007011784A (en) * | 2005-06-30 | 2007-01-18 | Fujitsu Ltd | Data sorting program, data sorting method and data sorting processor |
Non-Patent Citations (2)
Title |
---|
CSNG200900296021; 喜田拓也: 'STVF符号:頻度刈り込み接尾辞木を用いた効率よいVF符号化' 日本データベース学会論文誌 Vol.8 No.1, 20090626, P.P.125-130, 日本データベース学会 * |
JPN6013057038; 喜田拓也: 'STVF符号:頻度刈り込み接尾辞木を用いた効率よいVF符号化' 日本データベース学会論文誌 Vol.8 No.1, 20090626, P.P.125-130, 日本データベース学会 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014011538A (en) * | 2012-06-28 | 2014-01-20 | Fujitsu Ltd | Program for code processing and data structure |
CN103532565A (en) * | 2012-06-28 | 2014-01-22 | 富士通株式会社 | Code processing technique |
US9223809B2 (en) | 2012-06-28 | 2015-12-29 | Fujitsu Limited | Code processing technique |
CN103532565B (en) * | 2012-06-28 | 2016-12-28 | 富士通株式会社 | Code treatment technology |
EP2750053A1 (en) | 2012-12-28 | 2014-07-02 | Fujitsu Limited | Data storage program, data retrieval program, data retrieval apparatus, data storage method and data retrieval method |
JP2016034158A (en) * | 2015-12-07 | 2016-03-10 | 富士通株式会社 | Program for code processing, and data structure |
CN107463676A (en) * | 2017-08-04 | 2017-12-12 | 杭州安恒信息技术有限公司 | Text data store method and device |
CN107463676B (en) * | 2017-08-04 | 2020-06-30 | 杭州安恒信息技术股份有限公司 | Text data storage method and device |
CN110262289A (en) * | 2019-07-18 | 2019-09-20 | 潍柴动力股份有限公司 | The processing method of variable, device and storage medium in A2L file |
CN110262289B (en) * | 2019-07-18 | 2022-04-26 | 潍柴动力股份有限公司 | Method and device for processing variables in A2L file and storage medium |
Also Published As
Publication number | Publication date |
---|---|
JP5544998B2 (en) | 2014-07-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8838551B2 (en) | Multi-level database compression | |
US9710517B2 (en) | Data record compression with progressive and/or selective decomposition | |
JP5831298B2 (en) | Program, information processing apparatus, and index generation method | |
JP7118184B2 (en) | Text theme generation method, text theme generation device, electronic device, storage medium and computer program | |
Gueniche et al. | Compact prediction tree: A lossless model for accurate sequence prediction | |
JP4977589B2 (en) | Specific expression extraction device, specific expression extraction method, and program | |
JP5544998B2 (en) | Text processing apparatus, text processing method, and text processing program | |
US20160321282A1 (en) | Extracting method, information processing method, computer product, extracting apparatus, and information processing apparatus | |
US9916314B2 (en) | File extraction method, computer product, file extracting apparatus, and file extracting system | |
US8756216B1 (en) | Scalable tree builds for content descriptor search | |
US20120268297A1 (en) | Computer product, information processing apparatus, and information search apparatus | |
JP2001345710A (en) | Apparatus and method for compressing data | |
US9720976B2 (en) | Extracting method, computer product, extracting system, information generating method, and information contents | |
US8947272B2 (en) | Decoding encoded data | |
KR101234795B1 (en) | Apparatus and method for browsing contents | |
US8989507B2 (en) | Bitmap compression for fast searches and updates | |
KR20000054899A (en) | Searching device using moving picture index descripter and method thereof | |
JP7160986B2 (en) | Search model training method, apparatus, device, computer storage medium, and computer program | |
WO2015025467A1 (en) | Text character string search device, text character string search method, and text character string search program | |
CN108038109A (en) | Method and system, the computer program of Feature Words are extracted from non-structured text | |
JPH10261969A (en) | Data compression method and its device | |
JP5939259B2 (en) | Collation control program, collation control device, and collation control method | |
JP5346156B2 (en) | Program, inverted index storage method and search method | |
JP2006302082A (en) | Character string retrieval system | |
CN117290523B (en) | Full text retrieval method and device based on dynamic index table |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20130206 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20131113 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20131119 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140117 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20140415 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140428 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5544998 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |