Skip to main content

MREP: morpheme regular expression printer

Project description

https://travis-ci.org/unnonouno/mrep.svg?branch=master https://coveralls.io/repos/unnonouno/mrep/badge.png?branch=master

MREP is a regular expression matcher for morpheme sequences. You can find morpheme sub-sequences that match a given pattern, such as noun sequences.

Requirement

Install

$ pip install mrep

If you do not have a dictionary for MeCab, install unidic-lite.

$ pip install unidic-lite

If you want to install it from its source, use setup.py.

$ python setup.py install

Usage

usage: mrep [-h] [-o] [--color {never,auto,always}] [-n] [--mecab-arg MECAB_ARG]
            PATTERN [FILE [FILE ...]]
positional arguments:
PATTERN:

pattern

FILE:

data file

optional arguments:
-h, --help

show this help message and exit

-o, --only-matching

print only matching

--color COLOR

color mode. select from “never”, “auto” and “always”. (default: auto)

-n, --line-number

Show line number

--mecab-arg MECAB_ARG

argument to pass to mecab (ex: “-r /path/to/resource/file”)

Pattern

.

matches all morphemes

<surface=XXX>

matches morphemes whose surface are XXX

<pos=XXX>

matches morphemes whose POS are XXX

<feature=XXX>

matches morphemes whose features are XXX

<feature=~XXX>

matches morphemes whose features maches a RegExp pattern XXX

X*

matches repetiion of a pattern X

X|Y

matches X or Y

(X)

matches X

Example

<pos=名詞>

matches a noun

<pos=名詞>*

matches repetition of nouns

<pos=名詞>*<pos=助詞>

matches repetition of nouns and a particle

(<pos=名詞>|<pos=動詞>)*

matches repetition of nouns or verbs

License

This program is distributed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrep-0.2.0.tar.gz (9.3 kB view details)

Uploaded Source

File details

Details for the file mrep-0.2.0.tar.gz.

File metadata

  • Download URL: mrep-0.2.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9

File hashes

Hashes for mrep-0.2.0.tar.gz
Algorithm Hash digest
SHA256 18afbfe2e9ca11c0b80f5e0a55e346187c3f9ca9d5250f3ec0d114a39e09a6d8
MD5 2a538ec62344609c36d6bbe22f1a3993
BLAKE2b-256 e37792f96f89e0aa6eae318b32bf85ce327e23ef1e095c49541853d7c6d7fd5b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page