Win7&64 bit & how python3.6 installs stanfordcorenlp
1) install stanford nlp natural language processing package: pip install stanfordcorenlp.
2) download Stanford CoreNLP file Download CoreNLP 3.9.2
3) download the Chinese model jar package Chinese download 3.9.2
4) put the compressed stanford-corenlp-full-2018-10-05 folder and the downloaded stanford-chinese-corenlp 2018-02-27-models.jar in the same directory. I renamed the stanford-corenlp-full-2018-10-05 folder to stanfordnlp, and then put stanford-chinese-corenlp 2018-02-27-models.jar into it, the path is F:\ Learning\ machine_learning\ NLP\ stanfordnlp
5) reference the model in Python:
From stanfordcorenlp import StanfordCoreNLP# nlp = StanfordCoreNLP (ringing pathways, lang='zh') nlp = StanfordCoreNLP (ringing F:\ Learning\ machine_learning\ NLP\ stanfordnlp', lang='zh')
But there was an error: FileNotFoundError: [WinError 2] the system could not find the specified file.
There are few similar problems on the Internet, and the reason is finally found in the LC-HOU blog and the pit that big data and artificial intelligence have laid down: coreNLP is written in Java, and the running environment needs to be in JDK1.8.
So I downloaded jdk-8u171-windows-x64 (note that the file is very large)
Link: https://pan.baidu.com/s/1VSdGnSfWGkiSYNbVOMdDmw
Extraction code: 9uu4
Double-click the installation package, enter installation mode, and run-> next (N)
Then click next or, you can change the path where you want to install Java; (it is recommended that disk c is not installed)
Then click next or you can change the path where you want to install Java
After installation is complete, close the page
After the installation is complete, we can configure the environment variables for java. (the most important part)
Step1: go to the Properties option of computer and select Advanced system Settings
Step2: after clicking "Advanced system Settings", you will see the dialog box shown in the following figure. Select "Environment variables".
Step3: after clicking "Environment variable", create two new variable names JAVA_HOME and CLASSPATH, and add the path path
① New variable name: JAVA_HOME
Variable value: F:\ Learning\ java\ jdk1.8.0_171
Add the java environment that you just installed, that is, the directory where jdk1.8.0_171 is located, and include folders such as lib,bin,jre under this path
② New CLASSPATH variable
Variable value:.;% JAVA_HOME%\ lib;%JAVA_HOME%\ lib\ tools.jar
③ add path path
;% JAVA_HOME%\ bin;%JAVA_HOME%\ jre\ bin
Finally, verify that the configuration runs cmd successfully, enter java-version (there is a space between java and-version)
If the version information is displayed as shown in the figure, the installation and configuration are successful.
If you run it again, there will be no error from stanfordcorenlp import StanfordCoreNLPnlp = StanfordCoreNLP (ringing F:\ Learning\ machine_learning\ NLP\ stanfordnlp', lang='zh')