Skip to content

Commit

Permalink
Move _trim_text back
Browse files Browse the repository at this point in the history
  • Loading branch information
holtskinner committed Jun 13, 2024
1 parent ea76362 commit 03f7621
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions google/cloud/documentai_toolbox/wrappers/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,34 +113,34 @@ class FormField:

@cached_property
def field_name(self) -> str:
return self._trim_text(
return _trim_text(
_text_from_layout(
self.documentai_object.field_name, self._page._document_text
)
)

@cached_property
def field_value(self) -> str:
return self._trim_text(
return _trim_text(
_text_from_layout(
self.documentai_object.field_value, self._page._document_text
)
)

@staticmethod
def _trim_text(text: str) -> str:
"""Remove extra space characters from text (blank, newline, tab, etc.)

Args:
text (str):
Required. UTF-8 encoded text in reading order
from the document.
def _trim_text(text: str) -> str:
"""Remove extra space characters from text (blank, newline, tab, etc.)
Returns:
str:
Text without trailing spaces/newlines
"""
return text.strip().replace("\n", " ")
Args:
text (str):
Required. UTF-8 encoded text in reading order
from the document.
Returns:
str:
Text without trailing spaces/newlines
"""
return text.strip().replace("\n", " ")


@dataclasses.dataclass
Expand Down

0 comments on commit 03f7621

Please sign in to comment.