1. Python Interface
Thanks to Python compact design, the use of this dynamic language calls HanLP will save a lot of time, so this is more recommended installation.
The interfaces provided by the Python HanLP pyhanlp pack, which is mounted only one command:
pip install pyhanlp
This package is dependent on Java and JPype. Windows users If you encounter the following error:
building '_jpype' extensionerror: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools":http://visualstudio.microsoft.com/visual-cpp-build-tools/
Can follow the prompts to install Visual C ++, can also be used to solve this problem by installing more lightweight Miniconda or Anaconda.
Then execute the following command:
conda install -c conda-forge jpype1
pip install pyhanlp
If you experience problems related to Java:
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
Please install the Java Runtime Environment. HanLP main project developed in Java, so they need JDK or JRE.
2. Detection Installation and Configuration
All goes well, type the following at the command line, you can verify the installation and auto-configuration.
hanlp
Should an error occurs, the need to manually configure, from the actual github Tip: https://github.com/hankcs/pyhanlp to download and install the package on [data-for-1.7.5.zip hanlp-1.7.5-release .zip], and the two zip package E: \ Lib pyhanlp \ under static \ Anaconda3 \ site-packages \ , Data and extract, and then enter hanlp, can be installed successfully.
3. manual configuration
Source: https: //github.com/hankcs/pyhanlp/wiki/ manual configuration
4. Go to the interactive mode test word
Use the command `hanlp segment` word into the interactive mode, enter a sentence and press Enter, HanLP outputs segmentation results:
Reference Links: https://github.com/hankcs/HanLP