Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
VaclavRut committed Dec 11, 2024
1 parent 48e1bba commit e2a0516
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/learn/rossum-formulas/serverless-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,14 @@ This function retrieves and processes textual data from Rossum's page_data API f
import re
import requests

def find_variants(text):
def find_strings(text):
"""
Find specific patterns in the given text.
:param text: String to search patterns in.
:return: List of matches for defined patterns.
"""
# Patterns to match
# Example patterns to match, change these for your use case
patterns = [
r'\b[\w\d]{6}\.\w{2}\.\w{3}\b', # xxxxxx.xx.xxx
r'\b[\w\d]{6}\.\w{3}\.\w{2}\b', # xxxxxx.xxx.xx
Expand Down Expand Up @@ -421,7 +421,7 @@ def fetch_and_analyze_ocr_text(payload):
for item in page.get("items", []):
ocr_text = item.get("text", "")
if ocr_text:
ocr_matches = find_variants(ocr_text)
ocr_matches = find_strings(ocr_text)
if ocr_matches:
matches.append({
"page_id": page.get("id"),
Expand All @@ -436,5 +436,4 @@ def fetch_and_analyze_ocr_text(payload):
print(f"Attempt {attempt + 1} encountered an exception: {e}. Retrying...")

return matches

```

0 comments on commit e2a0516

Please sign in to comment.