Instructions to use doublesizebed/predict_malay_en with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- fastText
How to use doublesizebed/predict_malay_en with fastText:
from huggingface_hub import hf_hub_download import fasttext model = fasttext.load_model(hf_hub_download("doublesizebed/predict_malay_en", "model.bin")) - Notebooks
- Google Colab
- Kaggle
Commit History
-
Delete predict_malay_en.bin
Verified signature5532c9b -
Upload lid_ms_en.bin
Verified signature8ede2d7 -
Update README.md
Verified signatureimport fasttext import string # 1. Load your trained FastText LID model model = fasttext.load_model("lid_ms_en.bin") # your trained English↔Malay detector :contentReference[oaicite:0]{index=0} def tokenize(text): """ Simple tokenizer: - lowercases text - splits on whitespace - strips leading/trailing punctuation from each token """ tokens = text.lower().split() # split on any whitespace :contentReference[oaicite:1]{index=1} # strip punctuation from ends of each token return [t.strip(string.punctuation) for t in tokens if t.strip(string.punctuation)] def predict_per_token(sentence): """ Given a full sentence, return a list of (token, LANG) tuples """ preds = [] for token in tokenize(sentence): label, _ = model.predict(token) # returns (['__label__ms'], [0.98]) :contentReference[oaicite:2]{index=2} lang = label[0].replace("__label__", "").upper() preds.append((token, lang)) return pre…15b2bb9 -
Upload predict_malay_en.bin
Verified signaturea3c582d -
initial commit
Verified signaturec1b8dac