資源簡介
基于余弦相似性算法開發的論文查重系統
代碼片段和文件信息
package?lucene_3_tika;
import?myfirstapp.sys.App;
import?org.apache.lucene.analysis.Analyzer;
import?org.apache.lucene.analysis.standard.StandardAnalyzer;
import?org.apache.lucene.document.Document;
import?org.apache.lucene.document.Field;
import?org.apache.lucene.document.LongField;
import?org.apache.lucene.document.StringField;
import?org.apache.lucene.document.TextField;
import?org.apache.lucene.document.Field.Index;
import?org.apache.lucene.document.Field.Store;
import?org.apache.lucene.document.Field.TermVector;
import?org.apache.lucene.index.IndexWriter;
import?org.apache.lucene.index.IndexWriterConfig.OpenMode;
import?org.apache.lucene.index.IndexWriterConfig;
import?org.apache.lucene.index.Term;
import?org.apache.lucene.queryparser.classic.QueryParser;
import?org.apache.lucene.store.Directory;
import?org.apache.lucene.store.FSDirectory;
import?org.apache.tika.Tika;
import?org.apache.tika.exception.TikaException;
import?org.eclipse.core.runtime.IProgressMonitor;
import?org.eclipse.core.runtime.Status;
import?org.eclipse.swt.widgets.Text;
import?java.awt.Button;
import?java.awt.Checkbox;
import?java.awt.Choice;
import?java.awt.Dimension;
import?java.awt.frame;
import?java.awt.GridLayout;
import?java.awt.Label;
import?java.awt.List;
import?java.awt.Menu;
import?java.awt.MenuBar;
import?java.awt.MenuItem;
import?java.awt.Toolkit;
import?java.io.BufferedReader;
import?java.io.File;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.InputStreamReader;
import?java.io.StringReader;
import?java.nio.charset.StandardCharsets;
import?java.nio.file.FileVisitResult;
import?java.nio.file.Files;
import?java.nio.file.Path;
import?java.nio.file.Paths;
import?java.nio.file.SimpleFileVisitor;
import?java.nio.file.attribute.BasicFileAttributes;
import?java.util.Date;
public?class?IndexFile?{
String?indexPath;
String?docsPath;
Analyzer?analyzer;
static?Text?showResultText;
static?int?count?=?0;
Tika?tika?=?new?Tika();
public?IndexFile(String?docPath?Text?showResultText)?{
this.analyzer?=?App.App_lucene_analyzer;
this.indexPath?=?App.indexPath;
this.docsPath?=?docPath;
IndexFile.showResultText?=?showResultText;
}
public?void?index(String?indexMode)?{
final?Path?docDir?=?Paths.get(docsPath);
Date?start?=?new?Date();
try?{
//?if?(showResultText?!=?null)
//?IndexFile.showResultText.append(“開始分析文檔并創建索引至目錄:‘“?+?indexPath
//?+?“‘...\n\r“);
//?1.定義directory
Directory?dir?=?FSDirectory.open(Paths.get(indexPath));
//?3、定義iwc配置
IndexWriterConfig?iwc?=?new?IndexWriterConfig(analyzer);
if?(indexMode.equals(App.INDEX_MODE_CREAT))?{
iwc.setOpenMode(OpenMode.CREATE);
}?else?{
iwc.setOpenMode(OpenMode.APPEND);
}
//?4.定義writer
IndexWriter?writer?=?new?IndexWriter(dir?iwc);
indexDocs(writer?docDir?tika);
writer.close();
Date?end?=?new?Date();
//?if?(showResultText?!=?nu
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-09-24?14:11??myfirtstapp-master\
?????文件????????2727??2016-09-24?14:11??myfirtstapp-master\.classpath
?????文件???????????5??2016-09-24?14:11??myfirtstapp-master\.gitignore
?????文件?????????671??2016-09-24?14:11??myfirtstapp-master\.project
?????目錄???????????0??2016-09-24?14:11??myfirtstapp-master\.settings\
?????文件??????????79??2016-09-24?14:11??myfirtstapp-master\.settings\org.eclipse.core.resources.prefs
?????文件?????????364??2016-09-24?14:11??myfirtstapp-master\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2016-09-24?14:11??myfirtstapp-master\me
?????文件????????1278??2016-09-24?14:11??myfirtstapp-master\me
?????文件????????3420??2016-09-24?14:11??myfirtstapp-master\build.properties
?????目錄???????????0??2016-09-24?14:11??myfirtstapp-master\icons\
?????文件????????2200??2016-09-24?14:11??myfirtstapp-master\icons\LOGO16.gif
?????文件????????2816??2016-09-24?14:11??myfirtstapp-master\icons\LOGO32.gif
?????文件????????9340??2016-09-24?14:11??myfirtstapp-master\icons\alt_about.gif
?????文件???????51159??2016-09-24?14:11??myfirtstapp-master\icons\alt_launcher.icns
?????文件???????26694??2016-09-24?14:11??myfirtstapp-master\icons\alt_launcher.ico
?????文件???????10796??2016-09-24?14:11??myfirtstapp-master\icons\alt_launcher.xpm
?????文件?????????637??2016-09-24?14:11??myfirtstapp-master\icons\alt_window_16.gif
?????文件????????1192??2016-09-24?14:11??myfirtstapp-master\icons\alt_window_32.gif
?????目錄???????????0??2016-09-24?14:11??myfirtstapp-master\lib\
?????目錄???????????0??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\
?????文件???????45024??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\hamcrest-core-1.3.jar
?????文件??????330246??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\jcommon-1.0.23.jar
?????文件???????13796??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\jfreechart-1.0.19-experimental.jar
?????文件???????79793??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\jfreechart-1.0.19-swt.jar
?????文件?????1570157??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\jfreechart-1.0.19.jar
?????文件???????50769??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\jfreesvg-2.0.jar
?????文件??????445025??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\orsoncharts-1.4-eval-nofx.jar
?????文件???????72444??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\orsonpdf-1.6-eval.jar
?????文件???????80054??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\servlet.jar
?????文件???????17492??2016-09-24?14:11??myfirtstapp-master\lib\jfreechart\swtgraphics2d.jar
............此處省略100個文件信息
- 上一篇:Java城市公交查詢系統的設計與實現.zip
- 下一篇:基于java的抽獎系統
評論
共有 條評論