GithubHelp home page GithubHelp logo

yongwookha / kor-text-preprocess Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 1.0 40 KB

Korean text data preprocess toolkit for NLP

License: GNU General Public License v3.0

Python 100.00%
korean preprocessing tokenize text-cleaning mecab nlp tool text-processing

kor-text-preprocess's Introduction

kor-text-preprocess

Korean text data preprocess toolkit for NLP

Overview

This repository contains codes for Korean text preprocessing. There are several options you can use for now. Other functions will be added sooner or later.

Options

  • tokenize is about tokenizing sentences usually for morphological analysis. Classes of mecab and bpe are provided for now.
  • mecab from KoNLPy includes morphs, nouns and pos which are functions for your Korean text data.
  • bpe is imported from SentencePiece of Google. You need to train the BPE model first, and then tokenize your data using the model. Each methods are selectable by options.
  • clean_kor is for cleaning Korean text data like 'sejong corpus'. It will trim the unnecessary character and symbols. Of course you can customize the regular expression in src/clean.py

  • template for text data templating for certain task. For now, next_sentence_prediction template is only available. It arranges two sentences in a line with seperator [SEP]. Please read the description in src/template.py. Other task templates will be added in the list.

Environmnet

Ubuntu 16.04 (Mecab() class of konlpy is only provided on linux)

Requirement

$ pip install -r 'requirements.txt'
$ sudo apt-get install curl
$ bash <(curl -s https://raw.githubusercontent.com/konlpy/konlpy/master/scripts/mecab.sh)

Usage

> python main.py -h
> <help messages>

ex)
> python main.py -i "input_file" -o "output_file" -e 'utf8' \
                |-opt   |"tokenize" |--mecab|--morphs   |       |
                |       |           |       |--nouns    |       |
                |       |           |       |--pos      |       |
                |       |           |--bpe  |--train    |       | 
                |       |           |       |--model    |"model"|
                |       |           |       |--vocab    |30000  |
                |       |"clean_kor"|       |           |       |
                |       |"template" |--nsp  |-ms        |0      |
                |       |           |       |-s         |". "   |

kor-text-preprocess's People

Contributors

kyj7479 avatar yongwookha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

heeyngpark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.