diff --git a/carkov-logo.png b/carkov-logo.png new file mode 100644 index 0000000..8a3057d Binary files /dev/null and b/carkov-logo.png differ diff --git a/carkov-logo.svg b/carkov-logo.svg new file mode 100644 index 0000000..f0d1ac3 --- /dev/null +++ b/carkov-logo.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + carkov + carkov + carkov + + diff --git a/carkov/__init__.py b/carkov/__init__.py index 1a5e645..346eb08 100644 --- a/carkov/__init__.py +++ b/carkov/__init__.py @@ -4,4 +4,4 @@ # This is free software, see the included LICENSE for terms and conditions. # -version = '0.1.2' +version = '0.2.0' diff --git a/carkov/__main__.py b/carkov/__main__.py index 67662c0..b57be48 100644 --- a/carkov/__main__.py +++ b/carkov/__main__.py @@ -61,17 +61,18 @@ def parse_arguments() -> argparse.Namespace: chain_sub = subparsers.add_parser('chain', help="Output from a chainer") chain_sub.add_argument('input', help="The chain file to load", type=pathlib.Path) + chain_sub.add_argument('-u', '--unweighted', help="Don't weight token selection by statistical frequency.", action='store_true') chain_sub.add_argument('-c', '--count', help="Number of chain outputs to output", type=int, default=10) chain_sub.add_argument('-m', '--maxlen', help="Maximum length in tokens of output (0 is unlimited)", type=int, default=0) return parser.parse_args() -def print_chainer_output(chainer: Chain, random_state: Random): +def print_chainer_output(chainer: Chain, random_state: Random, weighted: bool = False): if chainer.analyzer_class in JOINERS: - print(JOINERS[cast(str, chainer.analyzer_class)](chainer.walk(random_state, True))) + print(JOINERS[cast(str, chainer.analyzer_class)](chainer.walk(random_state, weighted))) else: - print(chainer.walk(random_state, True)) + print(chainer.walk(random_state, weighted)) def command_analyze(args: argparse.Namespace) -> int: @@ -145,7 +146,7 @@ def command_chain(args: argparse.Namespace) -> int: args.count = 1 for _ in range(0, args.count): - print_chainer_output(chainer, r) + print_chainer_output(chainer, r, not args.unweighted) return 0 diff --git a/carkov/analyze/english.py b/carkov/analyze/english.py index 7373fa7..9f3348b 100644 --- a/carkov/analyze/english.py +++ b/carkov/analyze/english.py @@ -9,6 +9,12 @@ import nltk from .abstract import AbstractAnalyzer +try: + nltk.sent_tokenize("foo bar") +except LookupError: + nltk.download('punkt') + + class English(AbstractAnalyzer): def __init__(self, order, filters=None): if filters is None: diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 9787c3b..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,3 +0,0 @@ -[build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index b109572..3b7b3f0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = carkov -version = 0.1.2 +version = 0.2.0 description = A markov chainer library author = Aldercone Studio author_email = alderconestudio@gmail.com