This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
height: 700 | |
width: 960 | |
scrolling: no | |
border: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from indicnlp.transliterate.unicode_transliterate import ItransTransliterator | |
input_text='आज मौसम अच्छा है। इसलिए हम आज खेल सकते हैं!' | |
# Transliterate Hindi to Roman | |
print(ItransTransliterator.to_itrans(input_text, 'hi')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate a sequence of characters with a language model | |
def generate_seq(model, mapping, seq_length, seed_text, n_chars): | |
in_text = seed_text | |
# generate a fixed number of characters | |
for _ in range(n_chars): | |
# encode the characters as integers | |
encoded = [mapping[char] for char in in_text] | |
# truncate sequences to a fixed length | |
encoded = pad_sequences([encoded], maxlen=seq_length, truncating='pre') | |
# predict character |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from indicnlp.syllable import syllabifier | |
# Word to be broken into syllables | |
w='जगदीशचंद्र' | |
# Language code Hindi in this case | |
lang='hi' | |
# Break into syllables | |
print(' '.join(syllabifier.orthographic_syllabify(w,lang))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inltk.inltk import get_similar_sentences | |
# get similar sentences to the one given in hindi | |
output = get_similar_sentences('मैं आज बहुत खुश हूं', 5, 'hi') | |
print(output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inltk.inltk import tokenize | |
hindi_text = """प्राचीन काल में विक्रमादित्य नाम के एक आदर्श राजा हुआ करते थे। | |
अपने साहस, पराक्रम और शौर्य के लिए राजा विक्रम मशहूर थे। | |
ऐसा भी कहा जाता है कि राजा विक्रम अपनी प्राजा के जीवन के दुख दर्द जानने के लिए रात्री के पहर में भेष बदल कर नगर में घूमते थे।""" | |
# tokenize(input text, language code) | |
tokenize(hindi_text, "hi") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function draw() { | |
image(video, 0, 0, width, height); | |
// We can call both functions to draw all keypoints and the skeletons | |
drawKeypoints(); | |
drawSkeleton(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model2 = Sequential() | |
model2.add(Flatten(input_shape=(7,7,512))) | |
model2.add(Dense(100, activation='relu')) | |
model2.add(Dropout(0.5)) | |
model2.add(BatchNormalization()) | |
model2.add(Dense(10, activation='softmax')) | |
# compile the model | |
model2.compile(optimizer='adam', metrics=['accuracy'], loss='categorical_crossentropy') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# keras imports for the dataset and building our neural network | |
from keras.datasets import cifar10 | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Conv2D, MaxPool2D, Flatten | |
from keras.utils import np_utils | |
# loading the dataset | |
(X_train, y_train), (X_test, y_test) = cifar10.load_data() | |
# # building the input vector from the 32x32 pixels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# keras imports for the dataset and building our neural network | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Conv2D, MaxPool2D, Flatten | |
from keras.utils import np_utils | |
# to calculate accuracy | |
from sklearn.metrics import accuracy_score | |
# loading the dataset |