Sys-Traceback-1
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: ml311; pyv: 3.11.10 (main, Oct 3 2024, 07:29:13) [GCC 11.2.0]'
print(pyu.ps2("haystack-ai ollama-haystack python-dotenv"))
haystack-ai==2.8.0
ollama-haystack is not installed in the current environment.
python-dotenv==0.21.0
Read More
Sys Version
title: "Sys Version"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
Score: 0
Read More
Template
title: "Template"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
Score: 0
Read More
Text-Diff
title: "Text Diff"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
str1 = "I understand how customers do their choice. Difference"
str2 = "I understand how customers do their choice."
seq = difflib.SequenceMatcher(None, str1, str2)
def get_similarity(str1, str2 …
Read More
Text-Similarity
title: "Text Similarity"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
import nltk, string
from sklearn.feature_extraction.text import TfidfVectorizer
stemmer = nltk.stem.porter.PorterStemmer()
remove_punctuation_map = dict((ord(char), None) for char in string.punctuation)
def stem_tokens(tokens):
return [stemmer.stem(item) for item in tokens]
Read More
Text-Similarity-Finder
title: "Text Similarity Finder"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
def findSimilarity(param1, param2):
documents = (
param1,
param2
)
tfidf_vectorizer = TfidfVectorizer()
tfidf_matrix = tfidf_vectorizer.fit_transform(documents)
cosine = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix)
print(cosine)
Read More
Time With Periods
title: "Time With Periods"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
times = pd.date_range('2000-01-01', periods=4)
print(times)
DatetimeIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04'], dtype='datetime64[ns]', freq='D')
for time in times:
print(time)
2000-01-01 00:00:00
2000-01-02 …
Read More
Timeit-Simple
title: "Timeit Simple"
author: "Rj"
date: 2019-04-24
description: "-"
type: technical_note
draft: false
import timeit
import numpy as np
def add(x, y):
return x + y
repeat_number = 100000
e = timeit.repeat(
stmt='''add(a, b)''',
setup='''a=2; b=3;from __main__ import add''',
repeat=3,
number=repeat_number)
Read More
Timeit-Simple-2
title: "Timeit Simple 2"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
def some_function():
return map(lambda x: x^2, range(10))
time1 = timeit.timeit(some_function)
print(time1)
Score: 5
Read More
Total-Score-Calculator
total_score_list = []
for i in range(6):
current_score = random.randint(0, 6)
print(f'ball {i}, current score: {current_score}')
total_score_list.append(current_score)
ball 0, current score: 3
ball 1, current score: 0
ball 2, current score: 5
ball 3, current score: 1
ball 4, current score: 5
ball 5 …
Read More