Skip to content

Commit

Permalink
🔥 chore: clean up the files
Browse files Browse the repository at this point in the history
  • Loading branch information
Inventrohyder committed Dec 12, 2020
1 parent dd430ed commit a35d7c5
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 543 deletions.
Binary file removed Capture.png
Binary file not shown.
21 changes: 0 additions & 21 deletions Class 12.2 _ 989878474.ipynb

This file was deleted.

48 changes: 0 additions & 48 deletions Engine.pl

This file was deleted.

3 changes: 1 addition & 2 deletions Gui/gui_code_full.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
KB = """
%%KB
KB = """%%KB
%RULES
Expand Down
Binary file removed code.zip
Binary file not shown.
44 changes: 28 additions & 16 deletions fullcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,7 @@
import numpy as np
import requests

# Check if pyswip package needs to be installed


from pyswip.prolog import Prolog
from pyswip.easy import *

from pyswip import Prolog, Functor, Variable, Atom, registerForeign, call

prolog = Prolog() # Global handle to interpreter

Expand All @@ -189,8 +184,9 @@ def read_py(A: Atom, V: Atom, Y: Variable) -> bool:
It is used to get Yes, No questions.
Yes is normally evaluated by Prolog as True and any other input as False.
:param A: The question (askable) that the usere should be prompted with.
:param V: The value that the user needs to agree (yes) or disagree (any other input) with.
:param A: The question (askable) that the user should be prompted with.
:param V: The value that the user needs to agree (yes) or disagree
(any other input) with.
:param Y: The value that Prolog will match with as True. Normally it's 'Yes'.
:returns True if Y is a Prolog Variable and False otherwise.
Expand Down Expand Up @@ -233,11 +229,14 @@ def get_menu_input(MenuList: list, lst_lcs: list) -> str:
"""
Carries out the logic of identifying the choice of the user from the menu.
A user can either choose a number or write some text.
If they choose a number it has to be a valid number amoung the count of options given.
If they provide a string it has to have the best match (among the options) be more than 10%.
If they choose a number it has to be a valid number amount the count of
options given. If they provide a string it has to have the best match
(among the options) be more than 10%.
:param MenuList: The options that the user needs to choose from. They are stored as Prolog Atoms.
:param lst_lcs: The options stored in a list of strings that Python can interprate.
:param MenuList: The options that the user needs to choose from.
They are stored as Prolog Atoms.
:param lst_lcs: The options stored in a list of strings that Python
can interprate.
:returns a string of the option that the user chose.
"""
Expand Down Expand Up @@ -300,9 +299,22 @@ def most_appropriate(response: str, lst_lcs: list) -> str:

call(retractall(known))

#Using covidtracking API to give uptodate information
response = requests.get("https://api.covidtracking.com/v1/states/ca/current.json")
print("Here is a quick update on COVID situation in San Francisco: \nThe death toll as of",response.json()['checkTimeEt'], "is", response.json()['death'])
print("Today, the number of cases increased by",response.json()['positiveIncrease'],",while death cases increased by",response.json()['deathIncrease'],"\n")
# Using covidtracking API to give up to date information
response = requests.get(
"https://api.covidtracking.com/v1/states/ca/current.json"
)
print(
"Here is a quick update on COVID situation in San Francisco: \nThe death toll as of",
response.json()['checkTimeEt'],
"is",
response.json()['death']
)
print(
"Today, the number of cases increased by",
response.json()['positiveIncrease'],
",while death cases increased by",
response.json()['deathIncrease'],
"\n"
)
answer = [s for s in prolog.query("answer(X).", maxresult=1)]
print((answer[0]['X'] +"." if answer else "unknown."))
107 changes: 0 additions & 107 deletions gui_code.py

This file was deleted.

30 changes: 0 additions & 30 deletions lcs_code.py

This file was deleted.

71 changes: 0 additions & 71 deletions script.py

This file was deleted.

Loading

0 comments on commit a35d7c5

Please sign in to comment.