Simple-Regex
title: "Simple Regex"
author: "Raja CSP Raman"
date: 2019-04-29
description: "-"
type: technical_note
draft: false
pattern = 'awesome'
content = 'Duckduck go is awesome and it is getting better everyday'
match = re.search(pattern, content)
#print(match)
start = match.start()
end = match.end()
#print(match.string)
print(start, end)
Read More
Simple-Script-Reader
title: "Simple Script Reader"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
import requests
from bs4 import BeautifulSoup
# Collect and parse first page
page = requests.get('https://www.springfieldspringfield.co.uk/view_episode_scripts.php?tv-show=two-and-a-half-men&episode=s01e01')
soup = BeautifulSoup(page.text, 'html.parser')
content = soup.select('div.scrolling-script-container')[0 …
Read More
Simple-Session
title: "Simple Session"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
hello = tf.constant('Hello, TensorFlow!')
<tf.Tensor 'Const:0' shape=() dtype=string>
sess = tf.Session()
sess.run(hello)
Read More
Simple-Tensorflow
title: "Simple Tensorflow"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
<tf.Tensor 'Const:0' shape=() dtype=float32>
<tf.Tensor 'Const_1:0' shape=() dtype=float32 …
Read More
Simple-Test
title: "Simple Test"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
print("This is simple test")
Score: 5
Read More
Simple-Test-2
title: "Simple Test 2"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
print("This is simple test 2")
Score: 0
Read More
Simple-Text-Processing
title: "Simple Text Processing"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
import re
from nltk.tokenize import word_tokenize
from collections import Counter
from nltk.corpus import stopwords
text = ("""The cat is in the box. The cat likes the box. The box is over the cat.""")
Read More
Simple-Translator-With-Llm
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("transformers"))
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "Helsinki-NLP/opus-mt-en-fi"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
Read More
Simple-Tree
title: "Simple Tree"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
X = [[0, 0], [1, 1]]
Y = [0, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, Y)
print(clf.predict([[21., 21.]]))
Score: 5
Read More
Sin-Plot
title: "Sin Plot"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
import numpy as np
import matplotlib.pylab as plt
[20 21 22 23 24 25 26 27 28]
[ 0.91294525 0.83665564 -0 …
Read More