Project contain 4 module:
- PythonModule - contain python code for summarize text
- SummarizeAlgorith - Java code use Python algorithm and return summarize text
- Scraper - Program for Scrapping news from web
- Summarizer - Main program to get news
-
Install plugin Python plugin install , Python support
-
Go to "File -> Project Structure -> Project Settings -> Modules"
-
Click Add symbol "+"
-
Select New Module
-
Type Name as PythonModule - ignore warning about dirrectory is not empty
-
Select Language as Python
-
Select Inherit global site-packages
-
Select *Base interpreter" the same as your default Python from console. For check which Python interpreter use as default, run this command from terminal/console:
python -c "import os, sys; print(os.path.dirname(sys.executable))"
This instruction print a path of directory where is python executable file.
-
Set environment to dist-packages (or site-packages) folder. Go to "Run -> Edit Configurations -> select Spring Boot configuration -> Modify options -> in a section Operating system select Environment variables -> In a new textbox provide:
- For Windows:
LD_LIBRARY_PATH=C:\Users\<user name>\AppData\Roaming\Python\<python version>\site-packages
- For Linux:
LD_LIBRARY_PATH="/usr/local/lib/python<python version>/dist-packages"
For display your path to this file, should run this command:
python -m site
More info: How do I fix Unsatisfied Link Error: no jep in java.library.path?
- For Windows:
-
Next step you should install all neccessary library for Python script:
pip install jep pip install nltk pip install numpy pip install networkx pip install scipy
-
Now you can run Spring Boot project
- You should set environment:
export LD_LIBRARY_PATH="/usr/local/lib/python<python version>/dist-packages"$LD_LIBRARY_PATH
- install library for Python (step 10 for Intellij instruction)
Project is: finite.
The project was built to test natural language processing methods. The additional purpose of this project was to test the connection between Python code and Java code within one project. This test has been successful, and the project has been completed.