|
import streamlit as st |
|
import tl_calamancy_lg |
|
import os |
|
import os |
|
import pandas as pd |
|
import json |
|
|
|
|
|
cwd = os.getcwd() |
|
|
|
|
|
file_path = os.path.join(cwd, "dataset_v2.json") |
|
|
|
|
|
with open(file_path, 'r') as file: |
|
|
|
data = json.load(file) |
|
|
|
|
|
patterns_data = [] |
|
responses_data = [] |
|
|
|
for intent in data["intents"]: |
|
tag = intent["tag"] |
|
patterns = intent.get("patterns", []) |
|
responses = intent.get("responses", []) |
|
|
|
for pattern in patterns: |
|
patterns_data.append({"tag": tag, "pattern": pattern}) |
|
|
|
for response in responses: |
|
responses_data.append({"tag": tag, "response": response}) |
|
|
|
|
|
patterns_df = pd.DataFrame(patterns_data) |
|
responses_df = pd.DataFrame(responses_data) |
|
|
|
def main(): |
|
|
|
st.title("TagaCare") |
|
|
|
nlp = tl_calamancy_lg.load() |
|
|
|
doc1 = nlp("Pano gamutin ang sakit sa ngipin") |
|
|
|
st.success(doc1) |
|
|
|
for data in patterns_data: |
|
st.write(data) |
|
|
|
for data in responses_data: |
|
st.write(data) |
|
|
|
|
|
if __name__ == "__main__": |
|
main() |
|
|