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
digits = [ | |
'০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯', | |
] | |
vowels = [ | |
'অ', 'আ', 'ই', 'ঈ', 'উ', 'ঊ', 'ঋ', 'এ', 'ঐ', 'ও', 'ঔ', | |
] | |
consonants = [ | |
'ক', 'খ', 'গ', 'ঘ', 'ঙ', 'চ', 'ছ', 'জ', 'ঝ', 'ঞ', 'ট', 'ঠ', 'ড', 'ঢ', 'ণ', 'ত', 'থ', 'দ', 'ধ', 'ন', 'প', 'ফ', 'ব', | |
'ভ', 'ম', 'য', 'র', 'ল', 'শ', 'ষ', 'স', 'হ', 'ড়', 'ঢ়', 'য়', 'ৎ', 'ং', 'ঃ', 'ঁ', | |
] |
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
def levenshtein_distance(str1, str2): | |
m, n = len(str1), len(str2) | |
# Initialize a matrix to store distances | |
dp = [[0] * (n + 1) for _ in range(m + 1)] | |
# Fill the matrix with base cases | |
for i in range(m + 1): | |
for j in range(n + 1): | |
if i == 0: |
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
import cv2 | |
import numpy as np | |
def pad_image(image, padding_percent): | |
""" | |
Pad the image and return it | |
:param image: Numpy array | |
:param padding_percent: float | |
:return: padded_image: Numpy array | |
""" |
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
var seatplan = [ | |
[3, 4], | |
[4, 5], | |
[2, 3], | |
[3, 4], | |
]; | |
// var seatplan = [ | |
// [3, 2], | |
// [4, 3], | |
// [2, 3], |
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
Future pickDateTime(BuildContext context) async { | |
final date = await pickDate(context); | |
if (date == null) return; | |
final time = await pickTime(context); | |
if (time == null) return; | |
setState(() { | |
dateTime = DateTime( |
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
# Reading the dataset | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
df = pd.read_csv('SimpleLinearRegression.csv') | |
df.columns = ['YearsExperience', 'Salary'] | |
X = df['YearsExperience'] | |
y = df['Salary'] |
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
def multiply(mat1, mat2): | |
row1 = len(mat1) | |
col1 = len(mat1[0]) | |
rows2 = len(mat2) | |
col2 = len(mat2[0]) | |
result = zeros(row1, col2) | |
if (len(mat1[0]) != len(mat2)): | |
print('The two matrices cannot be multiplied') |
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
def subtract(mat1, mat2): | |
row1 = len(mat1) | |
col2 = len(mat2[0]) | |
result = zeros(row1, col2) | |
for i in range(row1): | |
for j in range(col2): | |
result[i][j] = mat1[i][j] - mat2[i][j] |
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
def add(mat1, mat2): | |
row1 = len(mat1) | |
col2 = len(mat2[0]) | |
result = zeros(row1, col2) | |
for i in range(row1): | |
for j in range(col2): | |
result[i][j] = mat1[i][j] + mat2[i][j] | |
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
def identity(n): | |
mat = zeros(n, n) | |
for i in range(n): | |
mat[i][i] = 1 | |
return mat | |
mat = identity(3) |
NewerOlder