Commit 12b9310a authored by Andrea Cascallar Fuentes's avatar Andrea Cascallar Fuentes
Browse files

Error idioma XMLServer solucionado

parent 7f006887
......@@ -131,6 +131,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
......
......@@ -19,7 +19,7 @@
*/
package simplenlg.server;
import simplenlg.lexicon.NIHDBLexicon;
import simplenlg.lexicon.spanish.XMLLexicon;
import simplenlg.xmlrealiser.XMLRealiser;
import java.io.*;
......@@ -27,7 +27,6 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.Properties;
/**
* SimpleServer is a program that realises xml requests.
......@@ -58,7 +57,7 @@ public class SimpleServer implements Runnable {
* will be searched for the lexicon file. Otherwise, the path below will
* be used.
*/
String lexiconPath = "src/main/resources/NIHLexicon/lexAccess2011.data";
String lexiconPath = "src/main/resources/default-spanish-lexicon.xml";
private ServerSocket serverSocket;
// control the run loop
private boolean isActive = true;
......@@ -153,26 +152,13 @@ public class SimpleServer implements Runnable {
System.out.println("Port Number used by Server is: " + serverSocket.getLocalPort());
// try to read the lexicon path from lexicon.properties file
try {
Properties prop = new Properties();
FileReader reader = new FileReader(new File("./src/main/resources/lexicon.properties"));
prop.load(reader);
String dbFile = prop.getProperty("DB_FILENAME");
if (null != dbFile)
lexiconPath = dbFile;
else
throw new Exception("No DB_FILENAME in lexicon.properties");
} catch (Exception e) {
e.printStackTrace();
}
lexiconPath = "./src/main/resources/default-spanish-lexicon.xml";
System.out.println("Server is using the following lexicon: "
+ lexiconPath);
XMLRealiser.setLexicon(new NIHDBLexicon(this.lexiconPath));
XMLRealiser.setLexicon(new XMLLexicon(this.lexiconPath));
}
/**
......@@ -200,7 +186,6 @@ public class SimpleServer implements Runnable {
System.out.println("Waiting for client on port " +
serverSocket.getLocalPort() + "...");
}
Socket clientSocket = serverSocket.accept();
handleClient(clientSocket);
} catch (SocketTimeoutException s) {
......
......@@ -4,10 +4,11 @@
package simplenlg.xmlrealiser;
import simplenlg.framework.DocumentElement;
import simplenlg.framework.Language;
import simplenlg.framework.NLGElement;
import simplenlg.lexicon.Lexicon;
import simplenlg.lexicon.NIHDBLexicon;
import simplenlg.realiser.english.Realiser;
import simplenlg.realiser.Realiser;
import java.io.IOException;
import java.io.Reader;
......@@ -196,6 +197,7 @@ public class XMLRealiser {
simplenlg.xmlrealiser.wrapper.XmlDocumentElement wt)
throws XMLRealiserException {
String output = "";
Realiser r;
if (wt != null) {
try {
if (lexicon == null) {
......@@ -204,7 +206,12 @@ public class XMLRealiser {
UnWrapper w = new UnWrapper(lexicon);
DocumentElement t = w.UnwrapDocumentElement(wt);
if (t != null) {
Realiser r = new Realiser(lexicon);
if (lexicon.getLanguage().equals(Language.SPANISH)) {
r = new simplenlg.realiser.spanish.Realiser(lexicon);
} else {
r = new simplenlg.realiser.english.Realiser(lexicon);
}
r.initialise();
NLGElement tr = r.realise(t);
......
......@@ -2,7 +2,7 @@
LexiconType=NIH
# NIH lexicon path
DB_FILENAME=./src/test/resources/NIHLexicon/lexAccess2011.data
DB_FILENAME=./src/test/resources/NIHLexicon/lexAccess2013.data
# default XML lexicon path
XML_FILENAME=./src/main/resources/default-lexicon.xml
XML_FILENAME=./src/main/resources/default-spanish-lexicon.xml
File mode changed from 100755 to 100644
SET DATABASE UNIQUE NAME HSQLDB2C42306E9B
SET DATABASE GC 0
SET DATABASE DEFAULT RESULT MEMORY ROWS 0
SET DATABASE EVENT LOG LEVEL 0
SET DATABASE SQL REFERENCES FALSE
SET DATABASE SQL SIZE TRUE
SET DATABASE SQL NAMES FALSE
SET DATABASE TRANSACTION CONTROL LOCKS
SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED
SET FILES WRITE DELAY 500 MILLIS
SET FILES BACKUP INCREMENT TRUE
SET FILES CACHE SIZE 10000
SET FILES CACHE ROWS 50000
SET FILES SCALE 8
SET FILES LOB SCALE 32
SET FILES DEFRAG 20
SET FILES NIO TRUE
SET FILES LOG TRUE
SET FILES LOG SIZE 50
SET DATABASE TEXT TABLE DEFAULTS ''
CREATE USER SA PASSWORD ''
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
SET SCHEMA PUBLIC
CREATE CACHED TABLE PUBLIC.LEX_RECORD(EUI VARCHAR(8) NOT NULL,BASE VARCHAR(100) NOT NULL,CATEGORY VARCHAR(5) NOT NULL,CSIGNATURE VARCHAR(20) NOT NULL,MSIGNATURE VARCHAR(20) NOT NULL,ASIGNATURE VARCHAR(20) NOT NULL,LASTACTION INTEGER NOT NULL,CDATE DATE,MDATE DATE,ADATE DATE,LEXRECORD VARCHAR(500) NOT NULL)
CREATE INDEX RINDEX1 ON PUBLIC.LEX_RECORD(EUI)
CREATE INDEX RINDEX2 ON PUBLIC.LEX_RECORD(BASE)
CREATE INDEX RINDEX3 ON PUBLIC.LEX_RECORD(CATEGORY)
CREATE INDEX RINDEX4 ON PUBLIC.LEX_RECORD(LASTACTION)
CREATE CACHED TABLE PUBLIC.INFL_VARS(INFLVARLC VARCHAR(100) NOT NULL,INFLVAR VARCHAR(100) NOT NULL,CAT INTEGER,INFLECTION INTEGER,EUI VARCHAR(8) NOT NULL,UNINFL VARCHAR(100) NOT NULL,CITATION VARCHAR(100))
CREATE INDEX IINDEX1 ON PUBLIC.INFL_VARS(INFLVARLC)
CREATE INDEX IINDEX2 ON PUBLIC.INFL_VARS(EUI)
ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1
SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC
GRANT DBA TO SA
SET TABLE PUBLIC.LEX_RECORD INDEX '9519039 9519039 1009272 8707391 9519039 0 0 0 0 0 448769'
SET TABLE PUBLIC.INFL_VARS INDEX '26397259 16822461 26397259 0 0 0 1561067'
SET SCHEMA SYSTEM_LOBS
INSERT INTO BLOCKS VALUES(0,2147483647,0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment