Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API (Application Programming Interface) #18

Open
maryjess opened this issue Sep 27, 2024 · 1 comment
Open

API (Application Programming Interface) #18

maryjess opened this issue Sep 27, 2024 · 1 comment
Labels
must-have Feature that must be on the app.

Comments

@maryjess
Copy link
Owner

maryjess commented Sep 27, 2024

NLTK

  • Process the receipt text with NLTK and return the parsed data as JSON to the app (?)
import nltk
import re

# Sample receipt text
text = """
    Walmart
    Date: 01/09/2024
    Milk: $3.00
    Bread: $2.50
    Eggs: $1.75
    Total: $7.25
"""

# Tokenize text
tokens = nltk.word_tokenize(text)

# Use regex to find items and prices
pattern = re.compile(r'([A-Za-z]+):\s\$(\d+\.\d{2})')
matches = pattern.findall(text)

# Extract data
items = [{'item': match[0], 'price': float(match[1])} for match in matches]
print(items)

Choices:

  • Axios
  • fetch

Resolves #4

@maryjess
Copy link
Owner Author

How?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
must-have Feature that must be on the app.
Projects
None yet
Development

No branches or pull requests

1 participant