Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Tool for NLP - handle file and text

Project description

# 🔨 nlp2 🔧

Tools for NLP using Python

This repertory used to handle file io and string cleaning/parsing

## Usage

Install:

` pip install nlp2 `

Before using : ` from nlp2 import * `

# Features

###File Handling

## get_folders_form_dir(path) Arguments - path(String) : getting all folders under this path (string) Returns - path(String)(generator) : path of folders under arguments path ## get_files_from_dir(path) Arguments - path(String) : getting all files under this path (string) Returns - path(String)(generator) : path of files under arguments path ## read_dir_files_into_lines(path) Arguments - path(String) : getting all files line by lines under this path (string) Returns - line(String)(generator) : files line under arguments path ## read_files_into_lines(path) Arguments - path(String) : getting content in input file path (string) Returns - path(String)(generator) : file line under arguments path

### String cleaning/parsing

## lines_into_sentence(lines) Arguments - lines(Array(String)) : lines array Returns - path(String)(generator) : split all line base on punctuations ## split_sentence_to_ngram(text) Arguments - path(String) : sentence to ngram

Returns - ngrams(Array) : ngrams array

Examples ` split_sentence_to_ngram("加州旅館") return ['加','加州',"加州旅","加州旅館","州","州旅","州旅館","旅","旅館","館"] ` ## split_sentence_to_ngram_inpart(text) Arguments - path(String) : sentence to ngram Returns - path(String)(generator) : multiple ngrams array in different start character Examples ` split_sentence_to_ngram("加州旅館") return [['加','加州',"加州旅","加州旅館"],["州","州旅","州旅館"],["旅","旅館"],["館"]] ` ## spilt_text_to_combine_ways(text) Arguments - text(String) : input text Returns - path(String)(generator) : all of the text combines ways Examples ` spilt_text_to_combine_ways("加州旅館") return ['加 州 旅 館', '加 州 旅館', '加 州旅 館', '加 州旅館', '加州 旅館', '加州旅 館', '加州旅館'] ` ## spilt_sentence_to_array(sentence) Arguments - sentence(String) : input text Returns - sentencearray(Array) : sentence array ## is_all_english(text) Arguments - text(String) : input text Returns - result(Boolean) : whether the text is all English or not ## is_contain_number(text) Arguments - text(String) : input text Returns - result(Boolean) : whether the text contain number or not ## is_contain_english(text) Arguments - text(String) : input text Returns - result(Boolean) : whether the text contain english or not ## full2half(text) Arguments - string(String) : input string which needs turn to half Returns - (String) : a half-string ## half2full(text) Arguments - text(String) : input string which needs turn to full Returns - (String) : a full-string

Project details


Release history Release notifications

History Node

1.0.2

History Node

1.0.1

This version
History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
nlp2-1.0.0-py2.py3-none-any.whl (5.5 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Mar 14, 2018
nlp2-1.0.0.tar.gz (3.3 kB) Copy SHA256 hash SHA256 Source None Mar 14, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page