GithubHelp home page GithubHelp logo

tanktechnology / rust_lemmatizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ian-nai/rust_lemmatizer

0.0 0.0 0.0 1.53 MB

A lemmatizing package written in Rust.

License: GNU General Public License v3.0

Rust 100.00%

rust_lemmatizer's Introduction

rust_lemmatizer

A lemmatizing package written in Rust.

How to Use

On Files

To lemmatize text in a file, run the get_lemmas script using the following arguments. This script saved to a file named "lemmatized.csv" or "lemmatized.txt" depending on user input.

Specify your filename, the path to your csv containing a list of lemmas and their associated forms, and your desired return format (csv, txt, or a Vec).

cargo run --bin get_lemmas [YOUR FILENAME] [PATH TO LEMMA FILE] [OUTPUT - txt, csv, or vec]

An example command would be:

cargo run --bin get_lemmas src/lemma_example.txt src/lemma_dict.csv csv 

On Strings

To lemmatize a string, run the get_lemmas_from_string script. Pass the following command, specifying your string, the file containing the list of lemmas and their forms, and your desired return format (csv, txt, or a Vec).

cargo run --bin get_lemmas_from_string ["YOUR STRING"] [PATH TO LEMMA FILE] [OUTPUT - txt, csv, or vec]

For example:

cargo run --bin get_lemmas_from_string "This is an example string." src/lemma_dict.csv vec

To use in your own project

For lemmatizing a file:

use rust_lemmatizer::get_words;

get_words(filename, dict_name, file_output);

For lemmatizing on a string:

use rust_lemmatizer::get_words_from_string;

get_words_from_string(string_to_analyze, dict_name, return_type);

Lemma List and Formatting

Source

The list of lemmas included here was sourced from this GitHub repo by Lin Wei.

The list was created by referencing the British Nation Corpus (BNC), NodeBox Linguistics and Yasumasa Someya's lemma list. From the original repo:

This lemma list is provided "as is" and is free to use for any research and/or educational purposes. The list currently contains 186,523 words (tokens) in 84,487 lemma groups.

Formatting

To create your own list of lemmas for use with the library, create a csv file formatted like the one included here. Use two columns, the first containing your lemmas and the second containing comma-separated forms of the lemmas. Include a header for each column.

rust_lemmatizer's People

Contributors

ian-nai 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.