-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from commonsense/morphfitting
Add morphfitting as a build step
- Loading branch information
Showing
21 changed files
with
5,369 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import click | ||
from .combine_assertions import combine_assertions | ||
from .reduce_assoc import reduce_assoc | ||
from .morphology import prepare_vocab_for_morphology, subwords_to_edges | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
|
||
@cli.command(name='combine') | ||
@click.argument('input', type=click.Path(readable=True, dir_okay=False)) | ||
@click.argument('output', type=click.Path(writable=True, dir_okay=False)) | ||
def run_combine(input, output): | ||
""" | ||
Combine edges that have the same relation, start, and end, into | ||
higher-level assertions that add their weights and sources. | ||
`input` is a tab-separated CSV file to be grouped into assertions. | ||
`output` is the combined assertions, as a Msgpack stream. | ||
""" | ||
combine_assertions(input, output) | ||
|
||
|
||
@cli.command(name='reduce_assoc') | ||
@click.argument('input', type=click.Path(readable=True, dir_okay=False)) | ||
@click.argument('output', type=click.Path(writable=True, dir_okay=False)) | ||
def run_reduce_assoc(input, output): | ||
""" | ||
Takes in a file of tab-separated simple associations, and removes | ||
low-frequency terms and associations that are judged unlikely to be | ||
useful by various filters. | ||
""" | ||
reduce_assoc(input, output) | ||
|
||
|
||
@cli.command('prepare_morphology') | ||
@click.argument('language') | ||
@click.argument('input', type=click.File('r')) | ||
@click.argument('output', type=click.File('w')) | ||
def run_prepare_morphology(language, input, output): | ||
prepare_vocab_for_morphology(language, input, output) | ||
|
||
|
||
@cli.command('subwords') | ||
@click.argument('language') | ||
@click.argument('input', type=click.File('r')) | ||
@click.argument('output', type=click.File('wb')) | ||
def run_subwords(language, input, output): | ||
subwords_to_edges(language, input, output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.