Giter Site home page Giter Site logo

choosewhatulike / chinese-ngram-lm-hadoop Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 16 KB

A distributed chinese n-gram language model implementation for train and test on large corpus , using Hadoop MapReduce.

License: MIT License

Java 100.00%
chinese-nlp language-model n-gram hadoop-mapreduce

chinese-ngram-lm-hadoop's Introduction

Chinese N-Gram Language Model MapReduce

A distributed chinese n-gram language model implementation for train and test on large corpus , using Hadoop MapReduce. The language model treat every chinese character as a "word", thus a tri-gram contains three characters. Trained model can be used in web search and other application with no struggle.

Compile

We use Maven to build our project.

Run

Train

Suppose you have compiled the project, having a jar named lm.jar. Now run the jar with training data path /input/train.dat, output path /output and the gram window size is 3(aka tri-gram). Note your input and output path must be HDFS paths, and input text must be encoded in UTF-8.

$ hadoop jar lm.jar train 3 /output /input/train.dat

You can find the trained model in /output/out/.

Test

You can also evaluate your language model with Perplexity metric. Suppose we want to evaluate our tri-gram model above with data in /input/eval.dat

$ hadoop jar lm.jar eval 3 /output /input/eval.dat

You can find the evaluate result in /output/eval.

Run together

You can also run train and test all together.

$ hadoop jar lm.jar all 3 /output /input/train.dat /input/eval.dat

chinese-ngram-lm-hadoop's People

Stargazers

 avatar  avatar  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.