-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
97 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#Sun Mar 04 14:21:45 CET 2018 | ||
#Wed May 01 19:21:05 CET 2019 | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(4.6)) | ||
override.workspace.settings=true | ||
eclipse.preferences.version=1 | ||
gradle.user.home= | ||
connection.project.dir= | ||
offline.mode=false | ||
build.scans.enabled=false | ||
offline.mode=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package kariminf.testing; | ||
|
||
import java.util.List; | ||
|
||
import kariminf.as.preProcess.PreProcessor; | ||
import kariminf.as.preProcess.StaticPreProcessor; | ||
import kariminf.as.tools.Data; | ||
|
||
public class TestPreProcess { | ||
|
||
public static void main(String[] args) { | ||
|
||
String text = ""; | ||
text += "My name is Karim, and I study informatics at ESI, which is at Algiers, to obtain Magister degree. "; | ||
text += "My research in ESI is about ATS, it is the intersection between IR and NLP. "; | ||
text += "In this research, the main idea is to find relevant sentences using IR technics. "; | ||
text += "The statistical features are the power of IR to find relevancy. "; | ||
text += "AI technics are used, such as learning algorithms to create models for each topic in the input text. "; | ||
|
||
Data data = new Data(); | ||
PreProcessor prep = new StaticPreProcessor("en"); | ||
prep.setData(data); | ||
prep.addText(text); | ||
prep.preProcess(); | ||
|
||
|
||
List<String> sentences = data.getSentences(); | ||
List<List<String>> sentWords = data.getSentWords(); | ||
List<List<Double>> sim = data.getSentSimilarities(); | ||
|
||
System.out.println(sim); | ||
|
||
|
||
} | ||
|
||
public static Data pp() { | ||
String text = ""; | ||
text += "My name is Karim, and I study informatics at ESI, which is at Algiers, to obtain Magister degree. "; | ||
text += "My research in ESI is about ATS, it is the intersection between IR and NLP. "; | ||
text += "In this research, the main idea is to find relevant sentences using IR technics. "; | ||
text += "The statistical features are the power of IR to find relevancy. "; | ||
text += "AI technics are used, such as learning algorithms to create models for each topic in the input text. "; | ||
|
||
Data data = new Data(); | ||
PreProcessor prep = new StaticPreProcessor("en"); | ||
prep.setData(data); | ||
prep.addText(text); | ||
prep.preProcess(); | ||
|
||
return data; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package kariminf.testing; | ||
|
||
import java.util.List; | ||
import kariminf.as.process.Scorer; | ||
import kariminf.as.process.tcc.BayesScoreHandler; | ||
import kariminf.as.process.tcc.NaiveCluster; | ||
import kariminf.as.process.tcc.Pos; | ||
import kariminf.as.process.tcc.TFB; | ||
import kariminf.as.tools.Data; | ||
|
||
public class TestTCC { | ||
|
||
public static void main(String[] args) { | ||
Data data = TestPreProcess.pp(); | ||
|
||
NaiveCluster nc = new NaiveCluster(0.25); | ||
BayesScoreHandler bsh = new BayesScoreHandler(nc); | ||
Scorer s = Scorer.create(bsh); | ||
s.setData(data);//calls bsh.setData(data) | ||
|
||
bsh.addFeature(new TFB());//calls TFB.setData(data); | ||
bsh.addFeature(new Pos());//calls Pos.setData(data) | ||
|
||
|
||
bsh.train();//must train before scoring | ||
s.scoreUnits(); | ||
|
||
List<Integer> order = s.getOrdered(); | ||
double sent1score = s.getScore(1);//sentence 1 score | ||
|
||
System.out.println(sent1score); | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters