chore: Update .gitignore to include all Python files

This commit updates the .gitignore file to include all Python files by using the `*.py` pattern. This change ensures that all Python files in the repository are tracked by Git.
main
Lasse Studion 2 years ago
parent 8fd1d94124
commit 0f20f9e66f
  1. 2
      .gitignore
  2. 1
      __init__.py
  3. 24
      llm_sentiment.py

2
.gitignore vendored

@ -1,5 +1,5 @@
* *
!.py !*.py
.env .env
!.gitignore !.gitignore
.venv .venv

@ -0,0 +1 @@
from arango_class import ArangoDB

@ -0,0 +1,24 @@
from arango_class import ArangoDB
from ollama_class import Ollama
# Initialize the Ollama class to use for questions to AI
ollama = Ollama()
# Get the connection to the Arango DB
arango = ArangoDB()
db = arango.db
# Get all speeches from the 'ev_speeches' collection, containing the 400 speeches filtered out from the European Parliament
speeches = arango.all_ev_speeches()
# Go through each speech and ask the AI if the speech is positive, negative or neutral towards electric vehicles
for speech in speeches:
text = speech['text']
prompt = f'''In the speech below something related to electric vehicles is mentioned.\n
"""{text}"""\n
Is the speech positive, negative or neutral when it comes to electric vehicles?
Asnwer ONLY with 'positive', 'negative' or 'neutral', NOTHING else.
'''
sentiment = ollama.generate(prompt=prompt)
speech['sentiment'] = sentiment
arango.update_ev_document(speech)
Loading…
Cancel
Save