Skip to content

Commit

Permalink
Add full orth function
Browse files Browse the repository at this point in the history
Function to get the full orth from the segment, to be used from now on instead of accessing orth directly
  • Loading branch information
Icemole committed Dec 10, 2024
1 parent 171880e commit 899a68a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,25 @@ def __init__(
self.start = start
self.end = end
self.track = track
self.orth = orth
self._orth = orth
self.left_context_orth = left_context_orth
self.right_context_orth = right_context_orth
self.speaker_name = speaker_name

self.recording = recording
self.recording = recording

def full_orth(self) -> str:
"""
:return: Left context orth (if any) + orth + right context orth (if any).
"""
text = ""
if self.left_context_orth is not None:
text += self.left_context_orth.strip() + " "
text += self.orth
if self.right_context_orth is not None:
text += " " + self.right_context_orth.strip()

return text

def fullname(self) -> str:
return self.recording.fullname() + "/" + self.name
Expand Down

0 comments on commit 899a68a

Please sign in to comment.