A Python3 tool to use ITU Turkish NLP Pipeline API
For details of the pipeline, please check the pipeline page and the sources below.
To be able to use the pipeline, you need an authentication token (details on API web page).
The tool reads the token from pipeline.token
file (under the same directory with the tool) by default.
Simply
python3 ./pipeline.caller.py filename
reads input file , prints the output under ./output/output<system_time>
You can select the pipeline tool by using -t
option
python3 ./pipeline.caller.py filename -t <tool_name>
default is "pipelineNoisy"
You can force the encoding for I/O by using -e
option
python3 ./pipeline.caller.py filename -e <encoding>
default is your system locale
And you can change the output directory by using -o
option
python3 ./pipeline.caller.py filename -o another_directory
default is "pipeline_caller_output"
Also python3 ./pipeline.caller.py --help
shows the help menu.
import pipeline_caller
caller = pipeline_caller.PipelineCaller()
result = caller.call(<tool_name>, <text>, <api_token>)
Check DEFAULTS block in the source code if you need (generally, you don't) to change one of these:
api_url = "http://tools.nlp.itu.edu.tr/SimpleApi"
pipeline_encoding = 'UTF-8'
token_path = "pipeline.token"
for command line tool
default_output_dir = "output"
default_enconding = locale.getpreferredencoding(False)
default encoding in your OS, for I/O operations in command line tool
default_separator_char_class = "[\.\?:;!]"
for command line tool, to separate sentences and process sentence by sentence
Copyright 2015 Ferit Tunçer, [email protected]
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.