Giter VIP home page Giter VIP logo

jpgrep's Introduction

jpgrep

grep for japanese text

これは何ですか?

日本語の文章から言葉を見つけ出すためのツールです。 単純な文字列の比較ではなく形態素解析にもとづいた結果が得られます。 例えば「事」を検索した場合に、別の単語である「事実」にはマッチしません。

インストール

Python のパッケージマネージャ PIP を使ってインストールします。

$ pip install git+https://github.com/momijiame/jpgrep.git

使い方

インストールすると jpgrep コマンドが使えるようになります。

特定のファイルから言葉を検索するには、検索する言葉とファイルまたはファイルが格納されているディレクトリを指定します。

$ jpgrep <word> <directory or file>

標準入力から検索する場合にはファイルの指定は不要です。

$ jpgrep <word>

一致しないものを探すには -v (--inverse) オプションをつけます。

$ jpgrep -v <word>

次のファイルには「事実」と「事」というふたつの単語が含まれています。 この中から「事」が含まれる行だけを検索してみましょう。

$ cat << EOF > sample.txt
それは事実です
そういう事です
EOF
$ jpgrep "事" sample.txt
sample.txt:そういう事です

標準入力から検索する場合にはファイルを指定する必要がありません。

$ cat sample.txt | jpgrep "事"
そういう事です

一致しないものを探すには -v オプションを使います。

$ jpgrep -v "事" sample.txt
sample.txt:それは事実です
sample.txt:

jpgrep's People

Contributors

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