Skip to content

Commit

Permalink
https://github.com/rreganjr/Requel/issues/7
Browse files Browse the repository at this point in the history
#8
#13
#15
branch 1.0.3

I added exception module and moved some exceptions to it, I removed RequelException and just use ApplicationException isntead. most are at the root level com.rreganjr.
I added initializer module and moved the SystemInitializer and AbstractSystemInitializer to it. I split this because both nlp and requel use it.
I added repository module and moved the repository package to it. I split this because both nlp and requel use it.
I added nlp module and moved the nlp package to it.

I removed the UserSet/UserSetImpl and replaced with Set<User> and TreeSet<User>

Signed-off-by: rreganjr <rreganjr@acm.org>
  • Loading branch information
rreganjr committed Mar 19, 2018
1 parent 1369e19 commit e07df7c
Show file tree
Hide file tree
Showing 263 changed files with 784 additions and 831 deletions.
34 changes: 25 additions & 9 deletions _maven-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,41 @@
</pluginRepositories>

<modules>
<module>../requel</module>
<module>../exception</module>
<module>../initializer</module>
<module>../command</module>
<module>../repository</module>
<module>../nlp</module>
<module>../requel</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>exception</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>initializer</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>command</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>nlp</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>repository</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>requel</artifactId>
Expand Down Expand Up @@ -248,14 +272,6 @@
<artifactId>spellchecker</artifactId>
<version>2.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-parser -->
<!--
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-parser</artifactId>
<version>3.8.0</version>
</dependency>
-->
<!-- https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp -->
<dependency>
<groupId>edu.stanford.nlp</groupId>
Expand Down
14 changes: 14 additions & 0 deletions command/command.iml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="exception" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:3.1.0.GA" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.2.14.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.22.0-GA" level="project" />
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.3.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-commons-annotations:3.1.0.GA" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.4.RELEASE" level="project" />
Expand Down
5 changes: 5 additions & 0 deletions command/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
</parent>

<dependencies>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>exception</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import java.io.FileOutputStream;

import com.rreganjr.AbstractIntegrationTestCase;
import com.rreganjr.nlp.dictionary.Dictionary;
import com.rreganjr.nlp.dictionary.Sense;
import com.rreganjr.nlp.dictionary.Word;
import com.rreganjr.nlp.dictionary.command.ExportDictionaryCommand;
import com.rreganjr.nlp.dictionary.impl.command.ExportDictionaryCommandImpl;
import com.rreganjr.nlp.dictionary.impl.command.ImportDictionaryCommandImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void testSimilarityCancerCold() throws Exception {
try {
assertMostSimilar("cancer", PartOfSpeech.NOUN, 1, "cold", PartOfSpeech.NOUN, 1);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -70,7 +70,7 @@ public void testSimilarityBankLibrary() throws Exception {
try {
assertMostSimilar("bank", PartOfSpeech.NOUN, 9, "library", PartOfSpeech.NOUN, 3);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -79,7 +79,7 @@ public void testSimilarityBankBrae() throws Exception {
try {
assertMostSimilar("bank", PartOfSpeech.NOUN, 1, "brae", PartOfSpeech.NOUN, 1);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -88,7 +88,7 @@ public void testSimilarityRunWalk() throws Exception {
try {
assertMostSimilar("run", PartOfSpeech.NOUN, 7, "walk", PartOfSpeech.NOUN, 1);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -97,7 +97,7 @@ public void testSimilarityRunDevelop() throws Exception {
try {
assertMostSimilar("run", PartOfSpeech.VERB, 37, "develop", PartOfSpeech.VERB, 18);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -107,7 +107,7 @@ public void testDefinitionSimilarityDepositDeposit() throws Exception {
assertMostDefinitionSimilarity("deposit", PartOfSpeech.NOUN, 4, "deposit",
PartOfSpeech.VERB, 2);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -116,7 +116,7 @@ public void testRelatednessDepositDeposit() throws Exception {
try {
assertMostRelated("deposit", PartOfSpeech.NOUN, 4, "deposit", PartOfSpeech.VERB, 2);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public void testDefinitionSimilarityBankDeposit() throws Exception {
assertMostDefinitionSimilarity("bank", PartOfSpeech.NOUN, 2, "deposit",
PartOfSpeech.VERB, 2);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -197,7 +197,7 @@ public void testDefinitionSimilarityBillPay() throws Exception {
assertMostDefinitionSimilarity("bill", PartOfSpeech.NOUN, 2, "pay", PartOfSpeech.VERB,
1);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -209,7 +209,7 @@ public void testDefinitionSimilarityBillUnconstitutional() throws Exception {
assertMostDefinitionSimilarity("bill", PartOfSpeech.NOUN, 1, "unconstitutional",
PartOfSpeech.ADJECTIVE, 1);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -221,7 +221,7 @@ public void testDefinitionSimilarityAmendmentUnconstitutional() throws Exception
assertMostDefinitionSimilarity("amendment", PartOfSpeech.NOUN, 2, "unconstitutional",
PartOfSpeech.ADJECTIVE, 1);
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -246,7 +246,7 @@ public void testColocations() throws Exception {
}
}
} catch (Exception e) {
log.error("exception in test: " + e, e);
AbstractIntegrationTestCase.log.error("exception in test: " + e, e);
throw e;
}
}
Expand All @@ -257,11 +257,11 @@ public void testDisambiguate() {
NLPText text = process(sentence);
long start = System.currentTimeMillis();
wordSenseDisambiguator.process(text);
log.info("wsd time: " + (System.currentTimeMillis() - start) + " ms");
log.info(constituentPrinter.process(text));
log.info(dependencyPrinter.process(text));
AbstractIntegrationTestCase.log.info("wsd time: " + (System.currentTimeMillis() - start) + " ms");
AbstractIntegrationTestCase.log.info(constituentPrinter.process(text));
AbstractIntegrationTestCase.log.info(dependencyPrinter.process(text));
String actualSenseInfo = senseInfoPrinter.process(text);
log.info(actualSenseInfo);
AbstractIntegrationTestCase.log.info(actualSenseInfo);
for (NLPText word : text.getLeaves()) {
if (word.getDictionaryWordSense() != null) {
Synset synset = word.getDictionaryWordSense().getSynset();
Expand All @@ -279,18 +279,18 @@ public void testDisambiguate2() {
NLPText text = process(sentence);
long start = System.currentTimeMillis();
wordSenseDisambiguator.process(text);
log.info("wsd time: " + (System.currentTimeMillis() - start) + " ms");
log.info(constituentPrinter.process(text));
log.info(dependencyPrinter.process(text));
AbstractIntegrationTestCase.log.info("wsd time: " + (System.currentTimeMillis() - start) + " ms");
AbstractIntegrationTestCase.log.info(constituentPrinter.process(text));
AbstractIntegrationTestCase.log.info(dependencyPrinter.process(text));
String actualSenseInfo = senseInfoPrinter.process(text);
log.info(actualSenseInfo);
AbstractIntegrationTestCase.log.info(actualSenseInfo);
for (NLPText word : text.getLeaves()) {
if (word.getDictionaryWordSense() != null) {
Synset synset = word.getDictionaryWordSense().getSynset();
log.info(word + "[" + synset.getId() + "]: " + synset.getDefinition());
log.info(word.getDictionaryWordSenseRelationInfo());
AbstractIntegrationTestCase.log.info(word + "[" + synset.getId() + "]: " + synset.getDefinition());
AbstractIntegrationTestCase.log.info(word.getDictionaryWordSenseRelationInfo());
} else {
log.info(word);
AbstractIntegrationTestCase.log.info(word);
}
}
TestCase.assertEqualsIgnoreWhitespace(expectedSenseInfo, actualSenseInfo);
Expand All @@ -317,7 +317,7 @@ private void assertMostSimilar(String lemma1, PartOfSpeech pos1, int senseRank1,
SenseRelationInfo expectedMaxSimilarity = wordSenseDisambiguator.similarity(
expectedMostSimilar.getSense1(), expectedMostSimilar.getSense2());

log.info(expectedMostSimilar + " -> " + expectedMaxSimilarity);
AbstractIntegrationTestCase.log.info(expectedMostSimilar + " -> " + expectedMaxSimilarity);
for (Sense sense1 : word1.getSenses()) {
for (Sense sense2 : word2.getSenses()) {
sensePairs.put(new SensePair(sense1, sense2), wordSenseDisambiguator.similarity(
Expand All @@ -334,7 +334,7 @@ private void assertMostSimilar(String lemma1, PartOfSpeech pos1, int senseRank1,
actualMostSimilar = key;
}
if (similarity.getRank() > 0.0) {
log.info(key + " -> " + similarity);
AbstractIntegrationTestCase.log.info(key + " -> " + similarity);
}
}
Assert.assertEquals(expectedMostSimilar, actualMostSimilar);
Expand All @@ -354,7 +354,7 @@ private void assertMostRelated(String lemma1, PartOfSpeech pos1, int senseRank1,
senseRank2);
SenseRelationInfo expectedMaxRelatedness = wordSenseDisambiguator.relatedness(
expectedMostRelated.getSense1(), expectedMostRelated.getSense2());
log.info(expectedMostRelated + " -> " + expectedMaxRelatedness);
AbstractIntegrationTestCase.log.info(expectedMostRelated + " -> " + expectedMaxRelatedness);

Word word1 = expectedMostRelated.getSense1().getWord();
Word word2 = expectedMostRelated.getSense2().getWord();
Expand Down Expand Up @@ -384,10 +384,10 @@ private void assertMostRelated(String lemma1, PartOfSpeech pos1, int senseRank1,
actualMostRelated.add(key);
}
if (relatedness.getRank() > 0.0) {
log.info(key + " -> " + relatedness);
AbstractIntegrationTestCase.log.info(key + " -> " + relatedness);
}
}
assertContains(expectedMostRelated, actualMostRelated);
AbstractIntegrationTestCase.assertContains(expectedMostRelated, actualMostRelated);
}

private void assertMostDefinitionSimilarity(String lemma1, PartOfSpeech pos1, int senseRank1,
Expand All @@ -397,7 +397,7 @@ private void assertMostDefinitionSimilarity(String lemma1, PartOfSpeech pos1, in
senseRank2);
SenseRelationInfo expectedMaxRelatedness = wordSenseDisambiguator.definitionSimilarity(
expectedMostRelated.getSense1(), expectedMostRelated.getSense2());
log.info(expectedMostRelated + " -> " + expectedMaxRelatedness);
AbstractIntegrationTestCase.log.info(expectedMostRelated + " -> " + expectedMaxRelatedness);

Word word1 = expectedMostRelated.getSense1().getWord();
Word word2 = expectedMostRelated.getSense2().getWord();
Expand Down Expand Up @@ -427,10 +427,10 @@ private void assertMostDefinitionSimilarity(String lemma1, PartOfSpeech pos1, in
actualMostRelated.add(key);
}
if (relatedness.getRank() > 0.0) {
log.info(key + " -> " + relatedness);
AbstractIntegrationTestCase.log.info(key + " -> " + relatedness);
}
}
assertContains(expectedMostRelated, actualMostRelated);
AbstractIntegrationTestCase.assertContains(expectedMostRelated, actualMostRelated);
}

protected static class SensePair {
Expand Down
32 changes: 32 additions & 0 deletions exception/exception.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:3.1.0.GA" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.2.14.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.22.0-GA" level="project" />
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.3.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-commons-annotations:3.1.0.GA" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
25 changes: 25 additions & 0 deletions exception/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>exception</artifactId>
<version>1.0.3</version>

<parent>
<groupId>com.rreganjr.requel</groupId>
<artifactId>maven-base</artifactId>
<version>1.0.3</version>
<relativePath>../_maven-base/pom.xml</relativePath>
</parent>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit e07df7c

Please sign in to comment.