GraphManager.patternCache.invalidateAll();
DataRelationshipManager.relationshipCache.invalidateAll();
ClassRelationshipCache.relationshipCache.invalidateAll();
PatternRelationshipCache.relationshipCache.invalidateAll();
GraphDatabaseService db = setUpDb();
GraphManager graphManager = new GraphManager("Pattern");
Node rootNode = getRootPatternNode(db, graphManager);
Map<String, String> text = new HashMap<>();
text.put("The first word in a sentence is interesting", "sentence");
text.put("The second word in a sentence is interesting", "sentence");
text.put("The third word in a sentence is interesting", "sentence");
text.put("The fourth word in a paragraph is interesting", "paragraph");
text.put("The fifth word in a sentence is interesting", "sentence");
text.put("The sixth word in a paragraph is interesting", "paragraph");
text.put("The seventh word in a sentence is interesting", "sentence");
text.put("The eighth word in a document is interesting", "document");
text.put("The ninth word in a sentence is interesting", "sentence");
text.put("The tenth word in a paragraph is interesting", "paragraph");
text.put("The eleventh word in a sentence is interesting", "sentence");
text.put("The twelfth word in a paragraph is interesting", "paragraph");
text.put("The thirteenth word in a sentence is interesting", "sentence");
text.put("The fourteenth word in a document is interesting", "document");
text.put("The fifteenth word in a sentence is interesting", "sentence");
text.put("The sixteenth word in a paragraph is interesting", "paragraph");
text.put("The seventeenth word in a sentence is interesting", "sentence");
text.put("The nineteenth word in a document is interesting", "document");
text.put("The twentieth word in a sentence is interesting", "sentence");
text.put("The twenty-first word in a paragraph is interesting", "paragraph");
text.put("The twenty-second word in a sentence is interesting", "sentence");
text.put("The twenty-third word in a document is interesting", "document");
text.put("The twenty-fourth word in a document is interesting", "document");
text.put("The twenty-fifth word in a document is interesting", "document");
text.put("The twenty-sixth word in a document is interesting", "document");
text.put("The first word in a sentence is interesting", "sentence");
text.put("The second word in a sentence is interesting", "sentence");
text.put("The third word in a sentence is interesting", "sentence");
text.put("The fourth word in a paragraph is interesting", "paragraph");
text.put("The fifth word in a sentence is interesting", "sentence");
text.put("The sixth word in a paragraph is interesting", "paragraph");
text.put("The seventh word in a sentence is interesting", "sentence");
text.put("The eighth word in a document is interesting", "document");
text.put("The ninth word in a sentence is interesting", "sentence");
text.put("The tenth word in a paragraph is interesting", "paragraph");
text.put("The eleventh word in a sentence is interesting", "sentence");
text.put("The twelfth word in a paragraph is interesting", "paragraph");
text.put("The thirteenth word in a sentence is interesting", "sentence");
text.put("The fourteenth word in a document is interesting", "document");
text.put("The fifteenth word in a sentence is interesting", "sentence");
text.put("The sixteenth word in a paragraph is interesting", "paragraph");
text.put("The seventeenth word in a sentence is interesting", "sentence");
text.put("The nineteenth word in a document is interesting", "document");
text.put("The twentieth word in a sentence is interesting", "sentence");
text.put("The twenty-first word in a paragraph is interesting", "paragraph");
text.put("The twenty-second word in a sentence is interesting", "sentence");
text.put("The twenty-third word in a document is interesting", "document");
text.put("The twenty-fourth word in a document is interesting", "document");
text.put("The twenty-fifth word in a document is interesting", "document");
text.put("The twenty-sixth word in a document is interesting", "document");
text.put("The first word in a sentence is interesting", "sentence");
text.put("The second word in a sentence is interesting", "sentence");
text.put("The third word in a sentence is interesting", "sentence");
text.put("The fourth word in a paragraph is interesting", "paragraph");
text.put("The fifth word in a sentence is interesting", "sentence");
text.put("The sixth word in a paragraph is interesting", "paragraph");
text.put("The seventh word in a sentence is interesting", "sentence");
text.put("The eighth word in a document is interesting", "document");
text.put("The ninth word in a sentence is interesting", "sentence");
text.put("The tenth word in a paragraph is interesting", "paragraph");
text.put("The eleventh word in a sentence is interesting", "sentence");
text.put("The twelfth word in a paragraph is interesting", "paragraph");
text.put("The thirteenth word in a sentence is interesting", "sentence");
text.put("The fourteenth word in a document is interesting", "document");
text.put("The fifteenth word in a sentence is interesting", "sentence");
text.put("The sixteenth word in a paragraph is interesting", "paragraph");
text.put("The seventeenth word in a sentence is interesting", "sentence");
text.put("The nineteenth word in a document is interesting", "document");
text.put("The twentieth word in a sentence is interesting", "sentence");
text.put("The twenty-first word in a paragraph is interesting", "paragraph");
text.put("The twenty-second word in a sentence is interesting", "sentence");
text.put("The twenty-third word in a document is interesting", "document");
text.put("The twenty-fourth word in a document is interesting", "document");
text.put("The twenty-fifth word in a document is interesting", "document");
text.put("The twenty-sixth word in a document is interesting", "document");
text.put("The first word in a sentence is interesting", "sentence");
text.put("The second word in a sentence is interesting", "sentence");
text.put("The third word in a sentence is interesting", "sentence");
text.put("The fourth word in a paragraph is interesting", "paragraph");
text.put("The fifth word in a sentence is interesting", "sentence");
text.put("The sixth word in a paragraph is interesting", "paragraph");
text.put("The seventh word in a sentence is interesting", "sentence");
text.put("The eighth word in a document is interesting", "document");
text.put("The ninth word in a sentence is interesting", "sentence");
text.put("The tenth word in a paragraph is interesting", "paragraph");
text.put("The eleventh word in a sentence is interesting", "sentence");
text.put("The twelfth word in a paragraph is interesting", "paragraph");
text.put("The thirteenth word in a sentence is interesting", "sentence");
text.put("The fourteenth word in a document is interesting", "document");
text.put("The fifteenth word in a sentence is interesting", "sentence");
text.put("The sixteenth word in a paragraph is interesting", "paragraph");
text.put("The seventeenth word in a sentence is interesting", "sentence");
text.put("The nineteenth word in a document is interesting", "document");
text.put("The twentieth word in a sentence is interesting", "sentence");
text.put("The twenty-first word in a paragraph is interesting", "paragraph");
text.put("The twenty-second word in a sentence is interesting", "sentence");
text.put("The twenty-third word in a document is interesting", "document");
text.put("The twenty-fourth word in a document is interesting", "document");
text.put("The twenty-fifth word in a document is interesting", "document");
text.put("The twenty-sixth word in a document is interesting", "document");
text.put("The twenty-third note in a ensemble is musical", "ensemble");
text.put("The twenty-fourth note in a ensemble is musical", "ensemble");
text.put("The twenty-fifth note in a ensemble is musical", "ensemble");
text.put("The twenty-sixth note in a ensemble is musical", "ensemble");
text.put("The first note in a ensemble is musical", "ensemble");
text.put("The second note in a ensemble is musical", "ensemble");
text.put("The third note in a ensemble is musical", "ensemble");
text.put("The fourth note in a ensemble is musical", "ensemble");
text.put("The fifth note in a ensemble is musical", "ensemble");
text.put("The sixth note in a ensemble is musical", "ensemble");
text.put("The seventh note in a ensemble is musical", "ensemble");
text.put("The ninth note in a ensemble is musical", "ensemble");
for (String str : text.keySet())
{
LearningManager.trainInput(Lists.asList(str, new String[0]), Lists.asList(text.get(str), new String[0]), graphManager, db);
}
String rootPattern;
try (Transaction tx = db.beginTx()) {
rootPattern = (String) rootNode.getProperty("pattern");
tx.success();
}
String input = "The fiftieth word in a document is interesting";