-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alberto Pettarin
committed
May 5, 2019
1 parent
ede4b3c
commit 359bcb3
Showing
21 changed files
with
363 additions
and
354 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Alberto Pettarin ([email protected]) | ||
Copyright (c) 2016-2019 Alberto Pettarin ([email protected]) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.0.8 | ||
0.0.9 |
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 |
---|---|---|
|
@@ -12,11 +12,11 @@ from __future__ import absolute_import | |
from ipapy.__main__ import main as package_main | ||
|
||
__author__ = "Alberto Pettarin" | ||
__copyright__ = "Copyright 2016, Alberto Pettarin (www.albertopettarin.it)" | ||
__copyright__ = "Copyright 2016-2019, Alberto Pettarin (www.albertopettarin.it)" | ||
__license__ = "MIT" | ||
__email__ = "[email protected]" | ||
|
||
__version__ = "0.0.8" | ||
__version__ = "0.0.9" | ||
__status__ = "Production" | ||
|
||
def main(): | ||
|
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 |
---|---|---|
|
@@ -16,18 +16,18 @@ | |
from ipapy.data import UNICODE_TO_IPA_MAX_KEY_LENGTH | ||
|
||
__author__ = "Alberto Pettarin" | ||
__copyright__ = "Copyright 2016, Alberto Pettarin (www.albertopettarin.it)" | ||
__copyright__ = "Copyright 2016-2019, Alberto Pettarin (www.albertopettarin.it)" | ||
__license__ = "MIT" | ||
__email__ = "[email protected]" | ||
|
||
__version__ = "0.0.8" | ||
__version__ = "0.0.9" | ||
__status__ = "Production" | ||
|
||
def split_using_dictionary(string, dictionary, max_key_length, single_char_parsing=False): | ||
""" | ||
Return a list of (non-empty) substrings of the given string, | ||
where each substring is either: | ||
1. the longest string starting at the current index | ||
that is a key in the dictionary, or | ||
2. a single character that is not a key in the dictionary. | ||
|
@@ -47,7 +47,7 @@ def substring(string, i, j): | |
return tuple([string[k][0] for k in range(i, j)]) | ||
# just return substring | ||
return string[i:j] | ||
|
||
if string is None: | ||
return None | ||
if (single_char_parsing) or (max_key_length < 2): | ||
|
@@ -73,7 +73,7 @@ def ipa_substrings(unicode_string, single_char_parsing=False): | |
""" | ||
Return a list of (non-empty) substrings of the given string, | ||
where each substring is either: | ||
1. the longest Unicode string starting at the current index | ||
representing a (known) valid IPA character, or | ||
2. a single Unicode character (which is not IPA valid). | ||
|
@@ -112,7 +112,7 @@ def invalid_ipa_characters(unicode_string, indices=False): | |
:param str unicode_string: the Unicode string to be parsed | ||
:param bool indices: if ``True``, return a list of pairs (index, invalid character), | ||
instead of a list of str (characters). | ||
:rtype: list of str or list of (int, str) | ||
:rtype: list of str or list of (int, str) | ||
""" | ||
if unicode_string is None: | ||
return None | ||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
from ipapy.ipastring import IPAString | ||
|
||
__author__ = "Alberto Pettarin" | ||
__copyright__ = "Copyright 2016, Alberto Pettarin (www.albertopettarin.it)" | ||
__copyright__ = "Copyright 2016-2019, Alberto Pettarin (www.albertopettarin.it)" | ||
__license__ = "MIT" | ||
__email__ = "[email protected]" | ||
|
||
|
@@ -105,7 +105,7 @@ def print_invalid_chars(invalid_chars, vargs): | |
|
||
def command_canonize(string, vargs): | ||
""" | ||
Print the canonical representation of the given string. | ||
Print the canonical representation of the given string. | ||
It will replace non-canonical compound characters | ||
with their canonical synonym. | ||
|
@@ -182,7 +182,7 @@ def command_clean(string, vargs): | |
|
||
def command_u2a(string, vargs): | ||
""" | ||
Print the ARPABEY ASCII string corresponding to the given Unicode IPA string. | ||
Print the ARPABEY ASCII string corresponding to the given Unicode IPA string. | ||
:param str string: the string to act upon | ||
:param dict vargs: the command line arguments | ||
|
@@ -200,7 +200,7 @@ def command_u2a(string, vargs): | |
|
||
def command_u2k(string, vargs): | ||
""" | ||
Print the Kirshenbaum ASCII string corresponding to the given Unicode IPA string. | ||
Print the Kirshenbaum ASCII string corresponding to the given Unicode IPA string. | ||
:param str string: the string to act upon | ||
:param dict vargs: the command line arguments | ||
|
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
from ipapy.mapper import Mapper | ||
|
||
__author__ = "Alberto Pettarin" | ||
__copyright__ = "Copyright 2016, Alberto Pettarin (www.albertopettarin.it)" | ||
__copyright__ = "Copyright 2016-2019, Alberto Pettarin (www.albertopettarin.it)" | ||
__license__ = "MIT" | ||
__email__ = "[email protected]" | ||
|
||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
import sys | ||
|
||
__author__ = "Alberto Pettarin" | ||
__copyright__ = "Copyright 2016, Alberto Pettarin (www.albertopettarin.it)" | ||
__copyright__ = "Copyright 2016-2019, Alberto Pettarin (www.albertopettarin.it)" | ||
__license__ = "MIT" | ||
__email__ = "[email protected]" | ||
|
||
|
@@ -41,7 +41,7 @@ def is_unicode_string(string): | |
def to_unicode_string(string): | ||
""" | ||
Return a Unicode string out of the given string. | ||
On Python 2, it calls ``unicode`` with ``utf-8`` encoding. | ||
On Python 3, it just returns the given string. | ||
|
@@ -54,7 +54,7 @@ def to_unicode_string(string): | |
return None | ||
if is_unicode_string(string): | ||
return string | ||
# if reached here, string is a byte string | ||
# if reached here, string is a byte string | ||
if PY2: | ||
return unicode(string, encoding="utf-8") | ||
return string.decode(encoding="utf-8") | ||
|
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
from ipapy.ipachar import IPATone | ||
|
||
__author__ = "Alberto Pettarin" | ||
__copyright__ = "Copyright 2016, Alberto Pettarin (www.albertopettarin.it)" | ||
__copyright__ = "Copyright 2016-2019, Alberto Pettarin (www.albertopettarin.it)" | ||
__license__ = "MIT" | ||
__email__ = "[email protected]" | ||
|
||
|
@@ -97,7 +97,7 @@ def convert_raw_tuple(value_tuple, format_string): | |
:param tuple value_tuple: the tuple of raw values | ||
:param str format_string: the format of the tuple | ||
:rtype: list of tuples | ||
""" | ||
""" | ||
values = [] | ||
for v, c in zip(value_tuple, format_string): | ||
if v is None: | ||
|
@@ -209,7 +209,7 @@ def load_ipa_data(): | |
ipa_to_unicode[obj.canonical_representation] = first_key | ||
obj.unicode_repr = first_key | ||
max_key_length = max(max_key_length, len(first_key)) | ||
# add all Unicode strings | ||
# add all Unicode strings | ||
for key in i_unicode_keys: | ||
if key in unicode_to_ipa: | ||
raise ValueError("The IPA data file contains a bad line, redefining codepoint '%s': '%s'" % (key, line)) | ||
|
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
Oops, something went wrong.