Run the follow commands to quickly setup and lunch
-
setup
git clone [email protected]:AcademiaSinicaNLPLab/SinicaSemanticParser.git cd SinicaSemanticParser ./setup.sh
2. run servers
```shell
cd system
./java_server.sh
./python_server.sh ## need another terminal
-
test if it works
./batch_run.sh ```
-
for Pythoners
from SinicaConcept.py import SinicaConcept sc = SinicaConcept(host="localhost", port=29999, verbose=True) sents = sc.load_txt(path='../input/input.txt') conceptsAll = sc.parseAll(sents) print conceptsAll ```
System for SenticNet Semantic analysis Challenge Task#2. The system is supposed to take input in the form of a text file and produce "concepts" extracted from each of the sentence in the required format mentioned at the challenge website (http://sentic.net/challenge/).
If you have directly downloaded it from github, you should have got 'SinicaSemanticParser-master.zip'. Please unzip it and rename the resulting directory to 'SinicaSemanticParser'.
Or you can just use git clone [email protected]:shafqatvirk/SinicaSemanticParser.git
to clone the entrie repository.
The system requires at least Java, Python, Stanford Parser, and apache-opennlp. The system has been tested with the following configurations:
-
Windows 7
- Java version 1.7 update 45
- Python 2.7.5
-
Windows 8
- Java version 1.7 update 55
- Python 2.7.5
-
Mac
- Java version 1.8.0
- Python 2.7.5
-
Linux (ubuntu 12.04)
- Java 1.7 update 55
- Python 2.7.3
This directory 'SinicaSemanticParser' contains the following directries:
1. classifier
2. data
3. headFinder
4. input
5. models
6. output
7. shared
8. system
9. temp
10. tools
A fast way to setup this system for Linux/Mac users:
- run:
./setup.sh
and jump tostep 4
below to lunch the server!
If you run on windows or prefer to manually insatll everything:
-
Please download Stanford Parser version 3.3.1 from this link, extract it and put the resulting
stanford-parser-full-2014-01-04
directory in theSinicaSemanticParser
directory. -
Please download
apache-opennlp-1.5.3-bin.zip
from here, extract it and put the resultingapache-opennlp-1.5.3
directory in theSinicaSemanticParser
directory.Note: Make sure after unzipping you get the directries named
stanford-parser-full-2014-01-04
andapache-opennlp-1.5.3
. We have observed depening on how to unzip it, you might getstanford-parser-full-2014-01-04/stanford-parser-full-2014-01-04
andapache-opennlp-1.5.3-bin/apache-opennlp-1.5.3
.In such cases just copy the
stanford-parser-full-2014-01-04
andapache-opennlp-1.5.3
toSinicaSemanticParser
directory. -
From the command prompt go into the 'SinicaSemanticParser/system' directory and compile java programs with the following command:
-
for windows
javac -cp .;..\stanford-parser-full-2014-01-04\stanford-parser.jar;..\stanford-parser-full-2014-01-04\stanford-parser-3.3.1-models.jar;..\classifier\maxent\lib\trove-3.0.3.jar;..\apache-opennlp-1.5.3\lib\opennlp-maxent-3.0.3.jar *.java
2. for __Linux__, __Mac__ ``` javac -cp .:../stanford-parser-full-2014-01-04/stanford-parser.jar:../stanford-parser-full-2014-01-04/stanford-parser-3.3.1-models.jar:../classifier/maxent/lib/trove-3.0.3.jar:../apache-opennlp-1.5.3/lib/opennlp-maxent-3.0.3.jar *.java
-
-
Now run the
ConceptExtractorServer
with the following command:-
for windows
java -cp .;..\stanford-parser-full-2014-01-04\stanford-parser.jar;..\stanford-parser-full-2014-01-04\stanford-parser-3.3.1-models.jar;..\classifier\maxent\lib\trove-3.0.3.jar;..\apache-opennlp-1.5.3\lib\opennlp-maxent-3.0.3.jar ConceptExtractorServer
2. for __Linux__, __Mac__ ``` java -cp .:../stanford-parser-full-2014-01-04/stanford-parser.jar:../stanford-parser-full-2014-01-04/stanford-parser-3.3.1-models.jar:../classifier/maxent/lib/trove-3.0.3.jar:../apache-opennlp-1.5.3/lib/opennlp-maxent-3.0.3.jar ConceptExtractorServer
You should see the following message:
Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCF G.ser.gz ... done [2.4 sec]. Server Initialized, Waiting for input...
Leave this server running.
-
-
Open another command line terminal (or split a new panel in
tmux
), go into theSinicaSemanticParser/system/
directory and startfeatureExtractorServer
by using the following command:
python featureExtractorServer.py
You should see the following message:
> "Loading...
> Ready!"
Leave this server running
6. Now place your input file in the `SinicaSemanticParser/input/` directory and name it **input.txt** (the input.txt should have one sentence per line)
7. Open another command line terminal, go into the `SinicaSemanticParser/system` directory and run the `ConceptExtractorBatchClient` by issuing the following command:
```
java -cp .:../stanford-parser-full-2014-01-04/stanford-parser.jar:../stanford-parser-full-2014-01-04/stanford-parser-3.3.1-models.jar:../classifier/maxent/lib/trove-3.0.3.jar:../apache-opennlp-1.5.3/lib/opennlp-maxent-3.0.3.jar ConceptExtractorBatchClient
```
If everything goes well, you should see the following message:
> "SocketClient initialized
> Processing......
> Done!"
8. The output has been stored in the `SinicaSemanticParser/output/output.txt`.