Simple-Regex

Fri 14 November 2025

title: "Simple Regex" author: "Raja CSP Raman" date: 2019-04-29 description: "-" type: technical_note draft: false


import re
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)
15 22 …

Category: regex

Read More

Simple-Script-Reader

Fri 14 November 2025

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 …

Category: webreader

Read More

Simple-Session

Fri 14 November 2025

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!')
hello
<tf.Tensor 'Const:0' shape=() dtype=string>
sess = tf.Session()
sess.run(hello)
b'Hello, TensorFlow!'
a = tf.constant(20 …

Category: tensorflow-work

Read More

Simple-Tensorflow

Fri 14 November 2025

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'
a = tf.constant(5.0)
a
<tf.Tensor 'Const:0' shape=() dtype=float32>
b = tf.constant(3.0)
b
<tf.Tensor 'Const_1:0' shape=() dtype=float32 …

Category: tensorflow-work

Read More

Simple-Test

Fri 14 November 2025

title: "Simple Test" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false


print("This is simple test")
This is simple test



28

Score: 5

Category: basics

Read More

Simple-Test-2

Fri 14 November 2025

title: "Simple Test 2" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false


print("This is simple test 2")
This is simple test 2


Score: 0

Category: basics

Read More

Simple-Text-Processing

Fri 14 November 2025

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.""")
tokens = [w for …

Category: textprocessing

Read More

Simple-Translator-With-Llm

Fri 14 November 2025

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"))
transformers==4.47.0

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)
2024-12 …

Category: mythraki

Read More

Simple-Tree

Fri 14 November 2025

title: "Simple Tree" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


from sklearn import tree
X = [[0, 0], [1, 1]]
Y = [0, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, Y)
print(clf.predict([[21., 21.]]))
[1]


Score: 5

Category: sklearn

Read More

Sin-Plot

Fri 14 November 2025

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
x = np.arange(20, 29)
print(x)
[20 21 22 23 24 25 26 27 28]
y = np.sin(x)
print(y)
[ 0.91294525  0.83665564 -0 …

Category: plot

Read More
Page 131 of 146

« Prev Next »