Skip to content

Commit

Permalink
hopefully fixes type not subscriptable error
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonic1999 committed Apr 14, 2021
1 parent 553872f commit 665f04f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/TRUNAJOD/syllabizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
| CC-CC | If four consonants are joined, they are halved. |
+----------------+------------------------------------------------------------+
"""

from typing import TypeVar

STRONG_VOWELS = {"a", "á", "e", "é", "o", "ó", "í", "ú"}
Expand Down Expand Up @@ -70,7 +69,8 @@
]


CharLine = TypeVar('CharLine')
CharLine = TypeVar("CharLine")


class CharLine(object):
"""Auxiliary object to set char types on a word.
Expand All @@ -93,7 +93,7 @@ def __init__(self, word):
self.type_line = "".join(chartype for _, chartype in charline)

@staticmethod
def char_type(char : str) -> str:
def char_type(char: str) -> str:
"""Get char type (vowel, consonant, etc).
This method checks a ``char`` type based on syllabization rules.
Expand All @@ -116,7 +116,7 @@ def char_type(char : str) -> str:
# c stands for consonant
return char if char in {"x", "s"} else "c"

def find(self, finder : str) -> int:
def find(self, finder: str) -> int:
"""Find string occurrence in the type representation.
:param finder: String to be searched
Expand All @@ -126,7 +126,7 @@ def find(self, finder : str) -> int:
"""
return self.type_line.find(finder)

def split(self, pos : int, where : int) -> tuple[CharLine, CharLine]:
def split(self, pos: int, where: int) -> [CharLine, CharLine]:
"""Split the object into two Charline objects.
:param pos: Start position of the split
Expand All @@ -141,7 +141,7 @@ def split(self, pos : int, where : int) -> tuple[CharLine, CharLine]:
CharLine(self.word[pos + where :]),
)

def split_by(self, finder : str, where : int) -> tuple[CharLine, CharLine]:
def split_by(self, finder: str, where: int) -> [CharLine, CharLine]:
"""Split charline by `finder` occurrence on `type_char`.
:param finder: Type char string
Expand Down Expand Up @@ -173,7 +173,7 @@ def __repr__(self) -> str:
"""
return "<" + repr(self.word) + ":" + self.type_line + ">"

def __eq__(self, other : CharLine) -> bool:
def __eq__(self, other: CharLine) -> bool:
"""Equal operator implementation.
:param other: CharLine to be compared to.
Expand All @@ -192,7 +192,7 @@ class Syllabizer(object):
"""

@staticmethod
def split(chars : CharLine) -> list[CharLine]:
def split(chars: CharLine) -> list[CharLine]:
"""Split CharLine into syllabes.
:param chars: Word to be syllabized
Expand Down Expand Up @@ -226,7 +226,7 @@ def split(chars : CharLine) -> list[CharLine]:
return [chars]

@staticmethod
def number_of_syllables(word : str) -> int:
def number_of_syllables(word: str) -> int:
"""Return number of sillables of a word.
:param word: Word to be processed
Expand Down

0 comments on commit 665f04f

Please sign in to comment.