Skip to content

fran-mora/wrant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wrant

Writing Assistant

A simple tool to find collocations of words in a given corpus. Useful for finding correct word usages and checking up phrases.

Requires python 3.X

Clone

git clone https://github.com/fm2g11/wrant.git
cd wrant

Prerequisites

You need to put some plain text files in data/books, ideally books of the same genre to what you want to check.

Install

make install  # will install requirements
make build    # will build a corpus based on the books you put in data/books

Run

from wrant import Wrant
wrant = Wrant()
wrant.concordance('stirrup')
wrant.concordance('scratched * back')  # * is a wild character for a single token
wrant.concordance('scratched', context=['back'])  # This means 'back' has to be somewhere around 'scratched'

Arguments

Wrant.concordance(
    text,
    width=90,
    lines=25,
    lemma=True,
    context=[],
    context_size=5
)
  • text: The piece of text to search for. Typically a word or an expression.
  • width: The number of characters to show for each results.
  • lemma: Whether to match on lemmas or original tokens. Applies to context too.
  • context: A list of words that needs to occur near the text.
  • context_size: Number of words (both left and right) from the text in which context applies to.

About

Writing Assistant

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors