File size: 1,220 Bytes
c57a856
db131d7
df11f29
694dd34
 
 
df11f29
 
 
 
 
694dd34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0790bf8
 
 
694dd34
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import streamlit as st
import tl_calamancy_lg
import os
import os
import pandas as pd
import json

# Get the absolute path of the script directory
cwd = os.getcwd()

# Read the CSV file
file_path = os.path.join(cwd, "dataset_v2.json")

# Open the JSON file
with open(file_path, 'r') as file:
    # Load the JSON data
    data = json.load(file)

# Extract patterns and responses into separate lists
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})

# Create DataFrames
patterns_df = pd.DataFrame(patterns_data)
responses_df = pd.DataFrame(responses_data)

def main():
    # StreamLit Title
    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()