Commit 2b9194f4 authored by Andrea Cascallar Fuentes's avatar Andrea Cascallar Fuentes

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	pom.xml
#	src/main/java/simplenlg/aggregation/AggregationRule.java
#	src/main/java/simplenlg/aggregation/ClauseCoordinationRule.java
#	src/main/java/simplenlg/framework/CoordinatedPhraseElement.java
#	src/main/java/simplenlg/framework/NLGFactory.java
#	src/main/java/simplenlg/lexicon/Lexicon.java
#	src/main/java/simplenlg/realiser/Realiser.java
#	src/main/resources/default-galician-lexicon.xml
#	src/test/java/simplenlg/external/english/ExternalTest.java
#	src/test/java/simplenlg/external/galician/ExternalTest.java
#	src/test/java/simplenlg/realiser/english/RealiserTest.java
#	src/test/java/simplenlg/syntax/english/AdjectivePhraseTest.java
#	src/test/java/simplenlg/syntax/english/ClauseTest.java
#	src/test/java/simplenlg/syntax/english/FeatureTest.java
#	src/test/java/simplenlg/syntax/english/InterrogativeTest.java
#	src/test/java/simplenlg/syntax/english/NounPhraseTest.java
#	src/test/java/simplenlg/syntax/english/PremodifierTest.java
#	src/test/java/simplenlg/syntax/english/PrepositionalPhraseTest.java
#	src/test/java/simplenlg/syntax/english/StringElementTest.java
#	src/test/java/simplenlg/syntax/english/TutorialTest.java
#	src/test/java/simplenlg/syntax/galician/InterrogativeTest2.java
#	src/test/java/simplenlg/syntax/spanish/InterrogativeTest.java
parents 1de6ba8c caee5a64
*.zip filter=lfs diff=lfs merge=lfs -text
*.data filter=lfs diff=lfs merge=lfs -text
/target/*
/.idea/*
/.settings/*
/src/test/resources/NIHLexicon/*
*.class
*.log
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
hs_err_pid*
......@@ -91,7 +91,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<!--<executions>
<execution>
<id>unzip</id>
<phase>process-test-resources</phase>
......@@ -118,7 +118,7 @@
<goal>run</goal>
</goals>
</execution>
</executions>
</executions>-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
<?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" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Maven: junit:junit:4.4">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/junit-4.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: gov.nih.nlm.nls.lexAccess.Api:LexAccess2011dist:0.0.1">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/lexAccess2011dist.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: org.apache.maven.plugins:maven-antrun-plugin:1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-project:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-profile:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact-manager:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-6" level="project" />
<orderEntry type="library" name="Maven: backport-util-concurrent:backport-util-concurrent:3.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-registry:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.11" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1" level="project" />
<orderEntry type="library" name="Maven: classworlds:classworlds:1.1-alpha-2" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:3.0.20" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant:1.9.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant-launcher:1.9.4" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -45,6 +45,13 @@ public abstract class AggregationRule {
this.factory = new NLGFactory();
}
/**
* Creates a new instance of AggregationRule
*/
public AggregationRule(NLGFactory factory) {
this.factory = factory;
}
/**
* @return the factory being used by this rule to create phrases
*/
......
......@@ -22,6 +22,7 @@ import simplenlg.features.Feature;
import simplenlg.features.InternalFeature;
import simplenlg.framework.CoordinatedPhraseElement;
import simplenlg.framework.NLGElement;
import simplenlg.framework.NLGFactory;
import simplenlg.framework.PhraseCategory;
import java.util.List;
......@@ -62,6 +63,13 @@ public class ClauseCoordinationRule extends AggregationRule {
super();
}
/**
* Constructs an instance of the ClauseCoordinationRule
*/
public ClauseCoordinationRule(NLGFactory factory) {
super(factory);
}
/**
* Applies aggregation to two NLGElements e1 and e2, succeeding only if they
* are clauses (that is, e1.getCategory() == e2.getCategory ==
......
......@@ -92,7 +92,7 @@ public class CoordinatedPhraseElement extends NLGElement {
* @param coordinate1 the first coordinate.
* @param coordinate2 the second coordinate.
*/
public CoordinatedPhraseElement(Object coordinate1, Object coordinate2) {
public CoordinatedPhraseElement(Object coordinate1, Object coordinate2) {
this(coordinate1, coordinate2, new NLGFactory());
}
......
......@@ -19,9 +19,7 @@
package simplenlg.framework;
import simplenlg.features.InternalFeature;
import simplenlg.features.LexicalFeature;
import simplenlg.lexicon.Lexicon;
import simplenlg.lexicon.galician.XMLLexicon;
import simplenlg.phrasespec.*;
import java.util.List;
......@@ -86,8 +84,12 @@ public class NLGFactory {
* Gets the lexicon used by this factory.
*/
public Lexicon getLexicon() {
if (lexicon == null)
this.lexicon = new XMLLexicon();
if (lexicon == null) {
//if lexicon == null, gets default lexicon
this.lexicon = Lexicon.getDefaultLexicon();
}
return this.lexicon;
}
......@@ -168,7 +170,7 @@ public class NLGFactory {
inflElement = new InflectedWordElement((WordElement) word);
} else if (word instanceof String) {
NLGElement baseword = createWord((String) word, category);
NLGElement baseword = createWord(word, category);
if (baseword != null && baseword instanceof WordElement) {
inflElement = new InflectedWordElement((WordElement) baseword);
......@@ -193,7 +195,7 @@ public class NLGFactory {
*/
@SuppressWarnings("unused")
private void doLexiconLookUp(LexicalCategory category, String word, NLGElement wordElement) {
WordElement baseWord = null;
WordElement baseWord;
if (LexicalCategory.NOUN.equals(category) && this.lexicon.hasWord(word, LexicalCategory.PRONOUN)) {
baseWord = this.lexicon.lookupWord(word, LexicalCategory.PRONOUN);
......@@ -371,13 +373,13 @@ public class NLGFactory {
if (specifier != null) {
//when possesive + noun add determiner -> determiner + possesive + noun
if(specifier.toString().equals("meu") || specifier.toString().equals("teu") || specifier.toString().equals("seu") || specifier.toString().equals("noso") || specifier.toString().equals("voso")) {
if (specifier.toString().equals("meu") || specifier.toString().equals("teu") || specifier.toString().equals("seu") || specifier.toString().equals("noso") || specifier.toString().equals("voso")) {
phraseElement.setSpecifier("o");
phraseElement.addSpecifier(specifier);
} else if (specifier.toString().equals("miña") || specifier.toString().equals("túa") || specifier.toString().equals("súa") || specifier.toString().equals("nosa") || specifier.toString().equals("vosa")) {
phraseElement.setSpecifier("a");
phraseElement.addSpecifier(specifier);
} else if(specifier.toString().equals("meus") || specifier.toString().equals("teus") || specifier.toString().equals("seus") || specifier.toString().equals("nosos") || specifier.toString().equals("vosos")) {
} else if (specifier.toString().equals("meus") || specifier.toString().equals("teus") || specifier.toString().equals("seus") || specifier.toString().equals("nosos") || specifier.toString().equals("vosos")) {
phraseElement.setSpecifier("os");
phraseElement.addSpecifier(specifier);
} else if (specifier.toString().equals("miñas") || specifier.toString().equals("túas") || specifier.toString().equals("súas") || specifier.toString().equals("nosas") || specifier.toString().equals("vosas")) {
......
......@@ -130,9 +130,36 @@ public abstract class Lexicon {
* @return default lexicon
*/
public static Lexicon getDefaultLexicon() {
return new simplenlg.lexicon.galician.XMLLexicon();
}
/**
* returns the English built-in lexicon
*
* @return default lexicon
*/
public static Lexicon getEnglishLexicon() {
return new simplenlg.lexicon.english.XMLLexicon();
}
/**
* returns the Spanish built-in lexicon
*
* @return default lexicon
*/
public static Lexicon getSpanishLexicon() {
return new simplenlg.lexicon.spanish.XMLLexicon();
}
/**
* returns the Galician built-in lexicon
*
* @return default lexicon
*/
public static Lexicon getGalicianLexicon() {
return new simplenlg.lexicon.galician.XMLLexicon();
}
/**
* Gets the language used by this factory.
*/
......
......@@ -139,72 +139,78 @@ public abstract class Realiser extends NLGModule {
debug.append("<br/>POST-SYNTAX TREE<br/>");
debug.append(postSyntax.printTree("&nbsp;&nbsp;").replaceAll("\n", "<br/>"));
}
//////////////////////////////verb + pronoun colocation/////////////////////////////////////////////////
//////////////////////////////Galician verb + pronoun colocation/////////////////////////////////////////////////
//negated and interrogative sentences: verb+pronoun
if(postSyntax.getCategory() != null && postSyntax.getCategory().equals(DocumentCategory.SENTENCE)) {
if (postSyntax.getFeatureAsBoolean(Feature.NEGATED) == false && postSyntax.getFeatureAsBoolean(Feature.INTERROGATIVE_TYPE) == false) {
pronoun_after = true;
}
List<NLGElement> elements = new ArrayList<NLGElement>();
if (postSyntax instanceof ListElement || postSyntax instanceof DocumentElement) {
elements.addAll(postSyntax.getChildren());
} else {
elements.add(postSyntax);
}
try {
if (this.syntax.getLexicon() != null && this.syntax.getLexicon().getLanguage().equals(Language.GALICIAN) /*&& postSyntax.getCategory() != null && postSyntax.getCategory().equals(DocumentCategory.SENTENCE)*/) {
if (postSyntax.getFeatureAsBoolean(Feature.NEGATED) == false && postSyntax.getFeatureAsBoolean(Feature.INTERROGATIVE_TYPE) == false) {
pronoun_after = true;
}
List<NLGElement> elements = new ArrayList<NLGElement>();
if (postSyntax instanceof ListElement || postSyntax instanceof DocumentElement) {
elements.addAll(postSyntax.getChildren());
} else {
elements.add(postSyntax);
}
elements = checkElements(elements);
elements = checkElements(elements);
int indexVerb = -1, indexSubordinate = -1, indexAdverb = -1, indexIndefinite = -1, indexInterrogative = -1, indexDesiderative = -1;
for (NLGElement e : elements) {
try {
if (e.getCategory().equals(LexicalCategory.VERB)) {
indexVerb = elements.indexOf(e);
}
} catch (Exception ex) {
int indexVerb = -1, indexSubordinate = -1, indexAdverb = -1, indexIndefinite = -1, indexInterrogative = -1, indexDesiderative = -1;
for (NLGElement e : elements) {
try {
if (e.getCategory().equals(LexicalCategory.VERB)) {
indexVerb = elements.indexOf(e);
}
} catch (Exception ex) {
try {
if (Arrays.asList(SUBORDINATES).contains(e.getRealisation())) {
indexSubordinate = elements.indexOf(e);
}
if (Arrays.asList(ADVERBS).contains(e.getRealisation()) || e.getCategory().equals(LexicalCategory.ADVERB)) {
indexAdverb = elements.indexOf(e);
}
if (Arrays.asList(INDEFINITES).contains(e.getRealisation())) {
indexIndefinite = elements.indexOf(e);
}
if (Arrays.asList(INTERROGATIVES).contains(e.getRealisation())) {
indexInterrogative = elements.indexOf(e);
}
if (Arrays.asList(DESIDERATIVES).contains(e.getRealisation())) {
indexDesiderative = elements.indexOf(e);
}
} catch (Exception ex) {
}
}
try {
if (Arrays.asList(SUBORDINATES).contains(e.getRealisation())) {
indexSubordinate = elements.indexOf(e);
if (indexVerb >= 0) {
//subordinates sentences: pronoun before
if (indexSubordinate >= 0 && indexSubordinate < indexVerb) {
pronoun_after = false;
}
if (Arrays.asList(ADVERBS).contains(e.getRealisation()) || e.getCategory().equals(LexicalCategory.ADVERB)) {
indexAdverb = elements.indexOf(e);
//with some adverbs: pronoun before
if (indexAdverb >= 0 && indexAdverb < indexVerb) {
pronoun_after = false;
}
if (Arrays.asList(INDEFINITES).contains(e.getRealisation())) {
indexIndefinite = elements.indexOf(e);
//with some indefinites: pronoun before
if (indexIndefinite >= 0 && indexIndefinite < indexVerb) {
pronoun_after = false;
}
if (Arrays.asList(INTERROGATIVES).contains(e.getRealisation())) {
indexInterrogative = elements.indexOf(e);
//with interrogatives: pronoun before
if (indexInterrogative >= 0 && indexInterrogative < indexVerb) {
pronoun_after = false;
}
if (Arrays.asList(DESIDERATIVES).contains(e.getRealisation())) {
indexDesiderative = elements.indexOf(e);
//in desideratives phrases: pronoun before
if (indexDesiderative >= 0 && indexDesiderative < indexVerb) {
pronoun_after = false;
}
} catch (Exception ex) {
}
}
if (indexVerb >= 0) {
//subordinates sentences: pronoun before
if (indexSubordinate >= 0 && indexSubordinate < indexVerb) {
pronoun_after = false;
}
//with some adverbs: pronoun before
if (indexAdverb >= 0 && indexAdverb < indexVerb) {
pronoun_after = false;
}
//with some indefinites: pronoun before
if (indexIndefinite >= 0 && indexIndefinite < indexVerb) {
pronoun_after = false;
}
//with interrogatives: pronoun before
if (indexInterrogative >= 0 && indexInterrogative < indexVerb) {
pronoun_after = false;
}
//in desideratives phrases: pronoun before
if (indexDesiderative >= 0 && indexDesiderative < indexVerb) {
pronoun_after = false;
}
} else {
pronoun_after = true;
}
}catch (Exception e) {
}
postSyntax.setFeature(Feature.PRONOUN_AFTER, pronoun_after);
......
......@@ -292316,7 +292316,7 @@
<base>quen</base>
<category>pronoun</category>
<gender>neuter</gender>
<number>singular</number>
<number>both</number>
<person>none</person>
</word>
<word>
This diff is collapsed.
......@@ -47,7 +47,7 @@ public class ExternalTest {
@Before
public void setup() {
lexicon = Lexicon.getDefaultLexicon();
lexicon = Lexicon.getEnglishLexicon();
phraseFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon);
}
......@@ -143,7 +143,7 @@ public class ExternalTest {
verbPhrase1 = this.phraseFactory.createVerbPhrase("perform"); //$NON-NLS-1$
CoordinatedPhraseElement coord1 = new CoordinatedPhraseElement(noun2,
noun3);
noun3, phraseFactory);
sentence1 = this.phraseFactory.createClause(noun1, verbPhrase1, coord1);
sentence1.setFeature(Feature.TENSE,Tense.PAST);
......@@ -418,7 +418,7 @@ public class ExternalTest {
// aggregation
SPhraseSpec s1 = this.phraseFactory.createClause("the man", "be", "hungry");
SPhraseSpec s2 = this.phraseFactory.createClause("the man", "buy", "an apple");
NLGElement result = new ClauseCoordinationRule().apply(s1, s2);
NLGElement result = new ClauseCoordinationRule(this.phraseFactory).apply(s1, s2);
Assert.assertEquals("The man is hungry and buys an apple.", realiser.realiseSentence(result));
}
......
......@@ -18,6 +18,7 @@
*/
package simplenlg.external.galician;
import gov.nih.nlm.nls.lvg.Lib.Category;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
......@@ -34,6 +35,7 @@ import simplenlg.realiser.galician.Realiser;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* Tests from third parties
......
......@@ -55,7 +55,7 @@ public class RealiserTest {
@Before
public void setup() {
lexicon = Lexicon.getDefaultLexicon();
lexicon = Lexicon.getEnglishLexicon();
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon);
}
......
......@@ -75,7 +75,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test {
// coordinate the two aps
CoordinatedPhraseElement coordap = new CoordinatedPhraseElement(
this.salacious, this.beautiful);
this.salacious, this.beautiful, this.phraseFactory);
Assert.assertEquals("incredibly salacious and amazingly beautiful", //$NON-NLS-1$
this.realiser.realise(coordap).getRealisation());
......@@ -86,7 +86,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test {
// coordinate this with a new AdjPhraseSpec
CoordinatedPhraseElement coord2 = new CoordinatedPhraseElement(coordap,
this.stunning);
this.stunning, this.phraseFactory);
Assert.assertEquals(
"incredibly salacious or amazingly beautiful and stunning", //$NON-NLS-1$
this.realiser.realise(coord2).getRealisation());
......@@ -95,7 +95,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test {
// "seriously and undeniably incredibly salacious or amazingly beautiful
// and stunning"
CoordinatedPhraseElement preMod = new CoordinatedPhraseElement(
new StringElement("seriously"), new StringElement("undeniably")); //$NON-NLS-1$//$NON-NLS-2$
new StringElement("seriously"), new StringElement("undeniably"), this.phraseFactory); //$NON-NLS-1$//$NON-NLS-2$
coord2.addPreModifier(preMod);
Assert.assertEquals(
......
......@@ -427,7 +427,7 @@ public class ClauseTest extends SimpleNLG4Test {
s5.setObject(this.phraseFactory.createNounPhrase("the", "cat")); //$NON-NLS-1$ //$NON-NLS-2$
CoordinatedPhraseElement coord = new CoordinatedPhraseElement(this.s3,
s5);
s5, this.phraseFactory);
complexS = this.phraseFactory.createClause();
complexS.setVerbPhrase(this.phraseFactory.createVerbPhrase("upset")); //$NON-NLS-1$
complexS.setFeature(Feature.TENSE, Tense.PAST);
......@@ -455,7 +455,7 @@ public class ClauseTest extends SimpleNLG4Test {
complexS.setFeature(Feature.TENSE, Tense.PAST);
complexS.setObject(this.phraseFactory.createNounPhrase("Peter")); //$NON-NLS-1$
s6.setObject(complexS);
coord = new CoordinatedPhraseElement(this.s3, s5);
coord = new CoordinatedPhraseElement(this.s3, s5, this.phraseFactory);
complexS.setSubject(coord);
this.s3.setFeature(Feature.PERFECT, true);
Assert.assertEquals(
......@@ -495,7 +495,7 @@ public class ClauseTest extends SimpleNLG4Test {
// the coordinate sentence allows us to raise and lower complementiser
CoordinatedPhraseElement coord2 = new CoordinatedPhraseElement(this.s1,
this.s3);
this.s3, this.phraseFactory);
coord2.setFeature(Feature.TENSE, Tense.PAST);
this.realiser.setDebugMode(true);
......@@ -635,7 +635,7 @@ public class ClauseTest extends SimpleNLG4Test {
// test agreement in passive
PhraseElement _s3 = this.phraseFactory.createClause(
new CoordinatedPhraseElement("my dog", "your cat"), "chase", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new CoordinatedPhraseElement("my dog", "your cat", this.phraseFactory), "chase", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"George"); //$NON-NLS-1$
_s3.setFeature(Feature.TENSE, Tense.PAST);
_s3.addFrontModifier("yesterday"); //$NON-NLS-1$
......@@ -643,7 +643,7 @@ public class ClauseTest extends SimpleNLG4Test {
this.realiser.realise(_s3).getRealisation());
_s3 = this.phraseFactory.createClause(new CoordinatedPhraseElement(
"my dog", "your cat"), "chase", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"my dog", "your cat", this.phraseFactory), "chase", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.phraseFactory.createNounPhrase("George")); //$NON-NLS-1$
_s3.setFeature(Feature.TENSE, Tense.PAST);
_s3.addFrontModifier("yesterday"); //$NON-NLS-1$
......
......@@ -196,7 +196,7 @@ public class FeatureTest extends SimpleNLG4Test {
NLGElement albert = phraseFactory.createWord("Albert", LexicalCategory.NOUN);
CoordinatedPhraseElement coord1 = new CoordinatedPhraseElement(
dave, albert);
dave, albert, this.phraseFactory);
PhraseElement born = phraseFactory.createClause(coord1, "be", "born");
born.setFeature(Feature.TENSE,Tense.PAST);
......
......@@ -83,7 +83,7 @@ public class InterrogativeTest extends SimpleNLG4Test {
CoordinatedPhraseElement subjects = new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("Jane"), //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew")); //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew"), this.phraseFactory); //$NON-NLS-1$
this.s4 = this.phraseFactory.createClause(subjects, "pick up", //$NON-NLS-1$
"the balls"); //$NON-NLS-1$
this.s4.addPostModifier("in the shop"); //$NON-NLS-1$
......@@ -184,7 +184,7 @@ public class InterrogativeTest extends SimpleNLG4Test {
setUp();
CoordinatedPhraseElement subjects = new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("Jane"), //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew")); //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew"), this.phraseFactory); //$NON-NLS-1$
this.s4 = this.phraseFactory.createClause(subjects, "pick up", //$NON-NLS-1$
"the balls"); //$NON-NLS-1$
this.s4.addPostModifier("in the shop"); //$NON-NLS-1$
......@@ -218,7 +218,7 @@ public class InterrogativeTest extends SimpleNLG4Test {
// balls in the shop
CoordinatedPhraseElement subjects = new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("Jane"), //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew")); //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew"), this.phraseFactory); //$NON-NLS-1$
this.s4 = this.phraseFactory.createClause(subjects, "pick up", //$NON-NLS-1$
"the balls"); //$NON-NLS-1$
this.s4.addPostModifier("in the shop"); //$NON-NLS-1$
......@@ -241,7 +241,7 @@ public class InterrogativeTest extends SimpleNLG4Test {
// create a complex vp: "kiss the dog and walk in the room"
setUp();
CoordinatedPhraseElement complex = new CoordinatedPhraseElement(
this.kiss, this.walk);
this.kiss, this.walk, this.phraseFactory);
this.kiss.addComplement(this.dog);
this.walk.addComplement(this.inTheRoom);
......@@ -249,7 +249,7 @@ public class InterrogativeTest extends SimpleNLG4Test {
// will walk in the room"
CoordinatedPhraseElement subjects = new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("Jane"), //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew")); //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew"), this.phraseFactory); //$NON-NLS-1$
this.s4 = this.phraseFactory.createClause(subjects, complex);
this.s4.setFeature(Feature.CUE_PHRASE, "however"); //$NON-NLS-1$
this.s4.addFrontModifier("tomorrow"); //$NON-NLS-1$
......@@ -264,10 +264,10 @@ public class InterrogativeTest extends SimpleNLG4Test {
setUp();
subjects = new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("Jane"), //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew")); //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew"), this.phraseFactory); //$NON-NLS-1$
this.kiss.addComplement(this.dog);
this.walk.addComplement(this.inTheRoom);
complex = new CoordinatedPhraseElement(this.kiss, this.walk);
complex = new CoordinatedPhraseElement(this.kiss, this.walk, this.phraseFactory);
this.s4 = this.phraseFactory.createClause(subjects, complex);
this.s4.setFeature(Feature.CUE_PHRASE, "however"); //$NON-NLS-1$
this.s4.addFrontModifier("tomorrow"); //$NON-NLS-1$
......@@ -283,8 +283,8 @@ public class InterrogativeTest extends SimpleNLG4Test {
this.realiser.setLexicon(this.lexicon);
subjects = new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("Jane"), //$NON-NLS-1$
this.phraseFactory.createNounPhrase("Andrew")); //$NON-NLS-1$
complex = new CoordinatedPhraseElement(this.kiss, this.walk);
this.phraseFactory.createNounPhrase("Andrew"), this.phraseFactory); //$NON-NLS-1$
complex = new CoordinatedPhraseElement(this.kiss, this.walk, this.phraseFactory);
this.kiss.addComplement(this.dog);
this.walk.addComplement(this.inTheRoom);
this.s4 = this.phraseFactory.createClause(subjects, complex);
......@@ -812,7 +812,7 @@ public class InterrogativeTest extends SimpleNLG4Test {
*/
@Test
public void testWhatObjectInterrogative() {
Lexicon lexicon = Lexicon.getDefaultLexicon();
Lexicon lexicon = Lexicon.getEnglishLexicon();
NLGFactory nlg = new NLGFactory(lexicon);
Realiser realiser = new Realiser(lexicon);
......
......@@ -315,7 +315,7 @@ public class NounPhraseTest extends SimpleNLG4Test {
public void testCoordination() {
CoordinatedPhraseElement cnp1 = new CoordinatedPhraseElement(this.dog,
this.woman);
this.woman, this.phraseFactory);
// simple coordination
Assert.assertEquals("the dog and the woman", this.realiser //$NON-NLS-1$
.realise(cnp1).getRealisation());
......@@ -344,7 +344,7 @@ public class NounPhraseTest extends SimpleNLG4Test {
this.woman.clearComplements();
CoordinatedPhraseElement cnp1 = new CoordinatedPhraseElement(this.dog,
this.woman);
this.woman, this.phraseFactory);
cnp1.setFeature(Feature.RAISE_SPECIFIER, true);
NLGElement realised = this.realiser.realise(cnp1);
Assert.assertEquals("the dog and woman", realised.getRealisation());
......@@ -353,7 +353,7 @@ public class NounPhraseTest extends SimpleNLG4Test {
this.woman.addComplement(this.behindTheCurtain);
CoordinatedPhraseElement cnp2 = new CoordinatedPhraseElement(this.dog,
this.woman);
this.woman, this.phraseFactory);
this.woman.setFeature(InternalFeature.RAISED, false);
Assert.assertEquals(
......@@ -399,7 +399,7 @@ public class NounPhraseTest extends SimpleNLG4Test {
public void testPossessiveCoordinate() {
// simple coordination
CoordinatedPhraseElement cnp2 = new CoordinatedPhraseElement(this.dog,
this.woman);
this.woman, this.phraseFactory);
Assert.assertEquals("the dog and the woman", this.realiser //$NON-NLS-1$
.realise(cnp2).getRealisation());
......
......@@ -47,7 +47,7 @@ public class PremodifierTest {
@Before
public void setup() {
lexicon = Lexicon.getDefaultLexicon();
lexicon = Lexicon.getEnglishLexicon();
phraseFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon);
}
......
......@@ -72,7 +72,7 @@ public class PrepositionalPhraseTest extends SimpleNLG4Test {
this.inTheRoom.clearComplements();
this.inTheRoom.addComplement(new CoordinatedPhraseElement(
this.phraseFactory.createNounPhrase("the", "room"), //$NON-NLS-1$ //$NON-NLS-2$
this.phraseFactory.createNounPhrase("a", "car"))); //$NON-NLS-1$//$NON-NLS-2$
this.phraseFactory.createNounPhrase("a", "car"), this.phraseFactory)); //$NON-NLS-1$//$NON-NLS-2$