Skip to content

Instantly share code, notes, and snippets.

View behitek's full-sized avatar
😎

Hieu Nguyen Van behitek

😎
View GitHub Profile
@behitek
behitek / 1.Xóa_dấu_tiếng_Việt_trong_Python.py
Last active September 27, 2024 08:32
Xóa dấu tiếng việt trong Python
import re
def no_accent_vietnamese(s):
s = s.lower()
s = re.sub('[áàảãạăắằẳẵặâấầẩẫậ]', 'a', s)
s = re.sub('[éèẻẽẹêếềểễệ]', 'e', s)
s = re.sub('[óòỏõọôốồổỗộơớờởỡợ]', 'o', s)
s = re.sub('[íìỉĩị]', 'i', s)
s = re.sub('[úùủũụưứừửữự]', 'u', s)
s = re.sub('[ýỳỷỹỵ]', 'y', s)
s = re.sub('đ', 'd', s)
@behitek
behitek / all-vietnamese-syllables.txt(Gõ dấu kiểu cũ)
Last active March 28, 2022 15:51
Từ điển từ đơn tiếng Việt
a
ai
am
an
ang
anh
ao
au
ay
ba
@behitek
behitek / tfidf-self-implement.ipynb
Last active January 16, 2019 06:06
Ví dụ tính tf-idf với python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@behitek
behitek / kmp.cpp
Created November 17, 2018 02:13 — forked from osjayaprakash/kmp.cpp
KMP
#include <iostream>
#include <cstring>
using namespace std;
int buildlps (char * pat, int m, int *lps){
lps[0] = lps[1] = 0;
for(int i=2; i<=m; i++){
int j = lps[i-1];
while(1){
@behitek
behitek / KMP.cpp
Created November 17, 2018 02:13 — forked from shihongzhi/KMP.cpp
KMP
//shihongzhi -- 2012.3.9
#include <stdio.h>
#include <string.h>
void KMP(char *T, char *P, int *pi)
{
int tLen = strlen(T);
int pLen = strlen(P);
int k = 0;
for (int i=0; i<tLen; ++i)
@behitek
behitek / Sparse Table.cpp
Created November 17, 2018 02:13 — forked from jacky860226/Sparse Table.cpp
Sparse Table
#define MAXN 100000
#define MAX_LOG 17
int n,s[MAXN+5];
int st[MAX_LOG+1][MAXN+5];
inline void init(){/*假設區間由[0~n-1]*/
for(int i=0;i<n;++i)st[0][i]=s[i];
for(int j=1;(1<<j)<=n;++j)
for(int i=0;i+(1<<j)<=n;++i)
st[j][i]=min(st[j-1][i],st[j-1][i+(1<<(j-1))]);
}
@behitek
behitek / trie.cpp
Created November 17, 2018 02:12 — forked from indrasaputra/trie.cpp
Trie
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <utility>
#include <cctype>
@behitek
behitek / QLSV.cpp
Last active November 5, 2018 02:41
Chương trình quản lý sinh viên - Bài tập Struct trong lập trình C
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
struct SinhVien{
char ten[30];
char gt[5];
int age;
float dT, dL, dH;
@behitek
behitek / notes.md
Last active October 18, 2018 08:48
Regex loại bỏ dấu tiếng việt - Chuyển tiếng việt có dấu thành không dấu

Regex loại bỏ dấu tiếng việt, chuyển tiếng việt có dấu thành không dấu

Author: Nguyễn Văn Hiếu

Des: Loại bỏ dấu tiếng Việt trên ngôn ngữ Python

Check out my blog: https://nguyenvanhieu.vn

import re

pats = [
 'á|à|ả|ã|ạ|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ',
@behitek
behitek / all-vietnamese-syllables.txt(Gõ dấu kiểu cũ)
Last active February 19, 2022 18:58 — forked from hieuthi/all-vietnamese-syllables.txt
All possibly existent Vietnamese syllables, created by combine all onsets with all rimes. More information can be found at: http://hieuthi.com/blog/2017/03/21/all-vietnamese-syllables.html
a
ai
am
an
ang
anh
ao
au
ay
ba