Giter Club home page Giter Club logo

g2p_id's People

Contributors

anantoj avatar dependabot[bot] avatar stevenlimcorn avatar w11wo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

g2p_id's Issues

Consider using `pylint` in your code

Pylint analyses your code without actually running it. It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored.

diff --git a/requirements_test.txt b/requirements_test.txt
index 9bc4cc5..bb585aa 100644
--- a/requirements_test.txt
+++ b/requirements_test.txt
@@ -3,4 +3,5 @@ flake8
 tox
 pytest
 pytest-cov
-mypy
\ No newline at end of file
+mypy
+pylint
diff --git a/tox.ini b/tox.ini
index d3b3b2d..3a13fa2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,6 +22,7 @@ commands =
     coverage xml -i -o coverage.xml
     flake8 g2p_id tests
     mypy g2p_id
+    pylint g2p_id
 
 [flake8]
 extend-ignore = E203

Sample of linting warnings

************* Module g2p_id
g2p_id/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module g2p_id.lstm
g2p_id/lstm.py:25:0: C0115: Missing class docstring (missing-class-docstring)
g2p_id/lstm.py:40:30: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
g2p_id/lstm.py:41:30: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
g2p_id/lstm.py:43:32: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
g2p_id/lstm.py:45:4: R0914: Too many local variables (16/15) (too-many-locals)
g2p_id/lstm.py:65:21: W0631: Using possibly undefined loop variable 't' (undefined-loop-variable)
g2p_id/lstm.py:25:0: R0903: Too few public methods (1/2) (too-few-public-methods)
************* Module g2p_id.bert
g2p_id/bert.py:26:0: C0115: Missing class docstring (missing-class-docstring)
g2p_id/bert.py:34:34: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
g2p_id/bert.py:36:32: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
g2p_id/bert.py:26:0: R0903: Too few public methods (1/2) (too-few-public-methods)
************* Module g2p_id.g2p
g2p_id/g2p.py:41:25: R1735: Consider using '{}' instead of a call to 'dict'. (use-dict-literal)
g2p_id/g2p.py:60:23: R1735: Consider using '{}' instead of a call to 'dict'. (use-dict-literal)
g2p_id/g2p.py:69:0: C0115: Missing class docstring (missing-class-docstring)
g2p_id/g2p.py:129:8: C0103: Variable name "_PHONETIC_MAPPING" doesn't conform to snake_case naming style (invalid-name)
g2p_id/g2p.py:148:8: C0103: Variable name "_CONSONANTS" doesn't conform to snake_case naming style (invalid-name)
g2p_id/g2p.py:166:25: R1714: Consider merging these comparisons with 'in' by using 'phn not in ('dʒ', 'tʃ')'. Use a set instead if elements are hashable. (consider-using-in)
g2p_id/g2p.py:69:0: R0903: Too few public methods (1/2) (too-few-public-methods)
************* Module g2p_id.text_processor
g2p_id/text_processor.py:34:0: C0115: Missing class docstring (missing-class-docstring)
g2p_id/text_processor.py:34:0: R0902: Too many instance attributes (14/7) (too-many-instance-attributes)
g2p_id/text_processor.py:56:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
g2p_id/text_processor.py:62:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
g2p_id/text_processor.py:68:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
g2p_id/text_processor.py:73:37: R1721: Unnecessary use of a comprehension, use self.thousands instead. (unnecessary-comprehension)
g2p_id/text_processor.py:75:57: R1721: Unnecessary use of a comprehension, use list(self.currencies) instead. (unnecessary-comprehension)
g2p_id/text_processor.py:78:25: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
g2p_id/text_processor.py:81:40: R1721: Unnecessary use of a comprehension, use list(self.measurements) instead. (unnecessary-comprehension)
g2p_id/text_processor.py:82:31: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
g2p_id/text_processor.py:83:37: R1721: Unnecessary use of a comprehension, use list(self.timezones) instead. (unnecessary-comprehension)
g2p_id/text_processor.py:84:59: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
g2p_id/text_processor.py:96:4: C0116: Missing function or method docstring (missing-function-docstring)
g2p_id/text_processor.py:104:4: C0116: Missing function or method docstring (missing-function-docstring)
g2p_id/text_processor.py:111:4: R0914: Too many local variables (29/15) (too-many-locals)
g2p_id/text_processor.py:152:19: W0718: Catching too general exception Exception (broad-exception-caught)
g2p_id/text_processor.py:172:19: W0718: Catching too general exception Exception (broad-exception-caught)
g2p_id/text_processor.py:192:19: W0718: Catching too general exception Exception (broad-exception-caught)
g2p_id/text_processor.py:209:19: W0718: Catching too general exception Exception (broad-exception-caught)
g2p_id/text_processor.py:234:27: W0718: Catching too general exception Exception (broad-exception-caught)
g2p_id/text_processor.py:111:4: R0912: Too many branches (29/12) (too-many-branches)
g2p_id/text_processor.py:111:4: R0915: Too many statements (92/50) (too-many-statements)
g2p_id/text_processor.py:29:0: C0411: standard import "import os" should be placed before "from num2words import num2words" (wrong-import-order)

------------------------------------------------------------------
Your code has been rated at 8.62/10 (previous run: 8.62/10, +0.00)

Handle `ps` Grapheme

For example, in words:

  • Psikologi,
  • Psikolog,
  • Psikopat,
  • etc.

The ps grapheme is read s (silent p). However, simply mapping ps -> s is only valid if they are within the same syllable.

ORT Provider

This ORT build has ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'] enabled. Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession.

[BUG] If the sentence contains . (dot) -- Exception KeyError: '.'

Hi I found that an error when the sentence contains a dot, for example 👇

from g2p_id import G2p
g2p = G2p()
print(g2p("Seniornya Brigadir Jendral  A.Yani mengambil alih pimpinan."))

--- will raise an Exception: KeyError: '.'

I don't really know phonemes, but what should I do when I have the sentence like that? should I replace the dot in the middle of the sentence to become silent sound?

But when I tried to give a space between dot and the next word, this library assumes there are two sentences, and only process the first part of the sentence.

I really appreciate your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.