Outline:
1.安裝
2.建立inverted index file
3.輸出inverted index file
安裝:
Lemur , 在安裝好Cygwin後 , 在我自己的使用方法上可以分為兩種 :
第一種是將Lemur下載安裝後 , 將bin資料夾裡面的可執行檔copy到cygwin的bin資料夾下.
(或是直接在window的命令列底下執行)
第二種是直接在Cygwin下進行compiler以及安裝.
(或是在Linux環境下進行compiler與安裝)
ref: http://sourceforge.net/apps/trac/lemur/wiki/Quick%20Start
指令執行:
在執行上 , 每個指令基本都需要一個parameter file ,
也就是說, 在設定好一個指令所需的parameter之後 ,
這個指令就直接針對這個parameter file進行執行即可.
以下是一個建立inverted index file的example ,
<parameters> <memory>200m</memory> <index>path/to/outputIndex</index> //設定inverted index file的output位置 <stemmer> <name>krovetz</name> //設定stemming所用的format </stemmer> <corpus> <path>path/to/collection1</path> <class>trectext</class> //設定corpus的資料來源 , 以及設定這些資料的格式 </corpus> <field><name>title</name></field> //設定想要資料的parse條件 <field><name>date</name><numeric>true</numeric><parserName>DateFieldAnnotator</parserName></field> </parameters>
attention : 在這裡的path都是以在當前目錄下來進行測試.
當建好parameter file之後 , 我們便可使用IndriBuildIndex指令來建出 Index file , 其指令為:
IndriBuildIndex parameter_file
此時會產生兩個資料夾 , 在index這個資料夾中便可找到我們所要的 invertedFile.
對於Trec格式 , 可以分為trectext以及trecweb , 分別的形式如下:
TRECTEXT format :
<DOC> <DOCNO>1</DOCNO> <TEXT> document content </TEXT> </DOC>
TRECWEB format :
<DOC> <DOCNO>...</DOCNO> <DOCHDR> ... e.g. URL and other metadata information </DOCHDR> ... HTML content </DOC>
輸出inverted index file
在建立好inverted index file之後 , 因為這是以Lemur本身的語言格式所建立,
如果我們想要觀看裡面內容的話 , 必須以dumpindex的指令將inverted index的內容
dump出來.
其指令格式為:
dumpindex <repository_path> <command>
其中repository_path代表的是我們儲存inverted index file的位置 , 以上述例子來講的話 ,
我們所要的repository_path就是 "path/to/outputIndex"
而command則是我們選擇要進行的動作 , 一般常用的command有:
invlist (il) | (None) | Print the contents of all inverted lists |
vocabulary (v) | (None) | Print the vocabulary of the index |
也就是 , 我們只要輸入dumpindex path/to/outputIndex il , 便是輸出全部的inverted lists
ref:http://sourceforge.net/apps/trac/lemur/wiki/dumpdoc,%20dumpterm,%20and%20dumpindex