Skip to content

Instantly share code, notes, and snippets.

Avatar
🎃
Wasteland Baby!

ehza ehzawad

🎃
Wasteland Baby!
View GitHub Profile
View json_to_csv_snips_NLU.py
import pandas as pd
import time
import io
import json
from langdetect import detect
from snips_nlu import SnipsNLUEngine
View gist:a30907eae2c9e727e63327586ffc6606
for i in l:
strr = '{' + '\r\n' + ' ' + '"text": ' + '"' + i + '"' +'\r\n' + '}'
strr = strr + ','
print(strr)
@ehzawad
ehzawad / damn_text.py
Last active Jan 3, 2023
Clean some weird encrypted data
View damn_text.py
import pandas as pd
import base64
unclean_data = pd.read_csv('/home/ehz/Downloads/email_date_dec22_Blank.csv')
# print(unclean_data)
# print(unclean_data.columns.tolist())
# print(unclean_data['Subject'])
# super_clean_data = unclean_data[[' Subject',' Customer-Email']].dropna(axis=0, how='any')
super_clean_data = unclean_data[' Customer-Email'].dropna(axis=0, how='any')
@ehzawad
ehzawad / dataset.json
Created Dec 29, 2022
One way of storing data!
View dataset.json
{
"entities": {
"taka":{
"data": [
{"value": "2 tk","synonyms": ["2 Taka"]}
],
"use_synonyms": true,
"automatically_extensible": true
},
"sms":{
View is_it_a_valid_json.json
{
"entities":{
"language":{
"data":[
{
"value":"English",
"synonyms":[
"English"
]
},
View hey_ya.json
{
"entities": {
"language":{
"data": [
{"value": "English","synonyms": ["English"]},
{"value": "Bangla","synonyms": ["Bangla"]}
],
"use_synonyms": true,
"automatically_extensible": true
}
View rasa_story.py
first = ['A']
second = ['B', 'C']
third = ['D', 'E', 'F']
intents_pack = [first, second, third]
if intents_pack.index(second) == 1:
print('Yes')
rasa_stories = [*first]
@ehzawad
ehzawad / dictionary_flow.py
Created Nov 13, 2022
intent and story management in rasa
View dictionary_flow.py
# iterate over a dictionary where values are lists
my_dict = { 'alreadyAMerchant': ['track_my_parcel', 'delivery_process', 'create_parcel', 'payment', 'coverage_area', 'merchant_info', 'compl: aints'], 'become_a_merchant': ['how_to_be_a_merchant', 'registration_process']}
track_my_parcel = ['This is where you check your product update', 'your parcel is gonna be delayed']
delivery_process = {'option1': 'this is option 1', 'option2': 'this is option 2'}
@ehzawad
ehzawad / data.py
Last active Nov 10, 2022
Intent-utter
View data.py
{
'greet': {'1': 'utter_greet'},
'check_balance': {'1':'utter_ask_account_number',
'2': {'inform':{'slot': 'account_number','value': None},'utter': 'utter_confirm_account_number'},
'3': {'confirm':{},'utter': 'utter_ask_pin'},
'4': {'inform':{'slot': 'PIN','value': None},'utter': 'utter_confirm_pin'},
'5': {'confirm':{},'utter': 'utter_balance'}},
'bKash_transfer': {'1':'utter_ask_account_number',
'2': {'inform':{'slot': 'account_number','value': None},'utter': 'utter_confirm_account_number'},
'3': {'confirm':{},'utter': 'utter_ask_phone_number'},
View yaml_parsar.py
# import yaml
# from yaml.loader import SafeLoader
#
# with open('userdetail.yaml') as f:
# data = yaml.load(f, Loader=SafeLoader)
# print(data)
#
import sys
from ruamel.yaml import YAML