Code Monkey home page Code Monkey logo

kr-preprocess's Introduction

KR-Preprocess

Preprocessing tool for Korean NLP tasks

Overview

Functions

  1. Removes all characters except essential punctuation and Korean/English characters
  2. Removes lines with only English
  3. Removes lines that are a part of a list (Begin with numeral + .)
  4. Cleans lines by removing parantheses and the content inside of parantheses
  5. Removes lines with links/html content
  6. Removes unmatched parantheses and brackets
  7. Cleans repeated items (아하하하하하하 -> 아하하)

Options

Pass these optional functions as booleans to argsparse

  1. --news: Cleans news items in Korean web crawl text
  2. --datetime: Cleans date-time text (ex. 2020-12-12 13:44)

Requirements

Refer to requirements.txt

pip install -r 'requirements.txt'

Usage

# Get help with options
python3 main.py -h

# Example usage
python3 main.py -i /data/dataset.txt -o /data_cleaned/dataset.txt -m 10 --news True -dt True

You can also add your custom regex functions to main.py to customize code for certain types of text data that require extra cleaning.

Example (in main.py):

    args = parser.parse_args()
    txt = PreProcessing(args)
    # Add extra cleaning step to cleain html text '\br' from all lines with one line
    txt.lines = [l.replace('/br','') for l in txt.lines]
    txt.apply()

References

kr-preprocess's People

Contributors

sybock avatar

Stargazers

 avatar

Watchers

 avatar

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.