Skip to content

Commit

Permalink
Fixed probability calculation at start of sentences; modernized typing
Browse files Browse the repository at this point in the history
  • Loading branch information
vthorsteinsson committed Aug 28, 2024
1 parent f7de0a4 commit c442c2f
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 302 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Miðeind ehf.
Copyright (C) 2024 Miðeind ehf.
Original author: Vilhjálmur Þorsteinsson

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ The Ngrams class
* ``str[] *args`` A parameter sequence of consecutive unigrams
to query the frequency for.
* **returns** An integer with the adjusted frequency of the unigram,
bigram or trigram. The adjusted frequency is the actual
frequency plus 1. The method thus never returns 0.
bigram or trigram. *The adjusted frequency is the actual*
*frequency plus 1.* The method thus never returns 0.

To query for the frequency of a unigram in the text, call
``ng.adj_freq("unigram1")``. This returns the number of times that
Expand Down Expand Up @@ -319,7 +319,7 @@ to placeholder strings, see the
Prerequisites
*************

This package runs on CPython 3.6 or newer, and on PyPy 3.6 or newer. It
This package runs on CPython 3.7 or newer, and on PyPy 3.7 or newer. It
has been tested on Linux (gcc on x86-64 and ARMhf), MacOS (clang) and
Windows (MSVC).

Expand Down Expand Up @@ -375,7 +375,7 @@ Changelog
Copyright and licensing
***********************

Icegrams is Copyright © 2022 `Miðeind ehf. <https://mideind.is>`__.
Icegrams is Copyright © 2024 `Miðeind ehf. <https://mideind.is>`__.
The original author of this software is *Vilhjálmur Þorsteinsson*.

This software is licensed under the **MIT License**:
Expand Down
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
setup.py
Copyright (C) 2020 Miðeind ehf.
Copyright (C) 2024 Miðeind ehf.
Author: Vilhjálmur Þorsteinsson
This software is licensed under the MIT License:
Expand Down Expand Up @@ -39,22 +39,24 @@
"""

from typing import Any

import io
import re
import sys

from glob import glob
from os.path import basename, dirname, join, splitext

from setuptools import find_packages, setup # type: ignore
from setuptools import find_packages, setup


if sys.version_info < (3, 7):
print("Icegrams requires Python >= 3.7")
sys.exit(1)


def read(*names, **kwargs):
def read(*names: Any, **kwargs: Any):
try:
return io.open(
join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
Expand Down
6 changes: 3 additions & 3 deletions src/icegrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__init__.py
Copyright (C) 2020 Miðeind ehf.
Copyright (C) 2024 Miðeind ehf.
Original author: Vilhjálmur Þorsteinsson
This software is licensed under the MIT License:
Expand Down Expand Up @@ -35,8 +35,8 @@

# Expose the icegrams API

from .ngrams import Ngrams, MAX_ORDER
from .ngrams import Ngrams, MAX_ORDER # type: ignore

__author__ = "Miðeind ehf."
__copyright__ = "(C) 2020 Miðeind ehf."
__copyright__ = "(C) 2024 Miðeind ehf."
__version__ = "1.1.2"
Loading

0 comments on commit c442c2f

Please sign in to comment.