Skip to content

Instantly share code, notes, and snippets.

View Davisy's full-sized avatar
🎯
Focusing

Davis David Davisy

🎯
Focusing
View GitHub Profile
from langdetect import detect_langs
sentence = "Tanzania ni nchi inayoongoza kwa utalii barani afrika"
print(detect_langs(sentence))
from langdetect import detect
sentence = "Tanzania ni nchi inayoongoza kwa utalii barani afrika"
print(detect(sentence))
<?php
use Illuminate\Support\Facades\Route;
Route::get('/','SpamController@show_form')->name('spam.form');
Route::post('/sms-spam-detect','SpamController@detect')->name('spam.detect');
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Algorithmia;
class SpamController extends Controller
{
@Davisy
Davisy / detect.php
Last active November 29, 2020 15:36
<?php
use Algorithmia;
// perform spam detection
public function detect(Request $request){
// valaidate the input
$this->validate($request, [
'message' => 'required|string|min:25',
<?php
// show form to write the sms message
public function show_form()
{
return view('sms_spam_form');
}
<html>
<head>
<title>SMS Spam Prediction Results</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"
/>
<style>
<html>
<head>
<title>SMS Spam Prediction</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
# load your hyperparameter searches
study = joblib.load('optuna_searches/study.pkl')
# save your hyperparameter searches
joblib.dump(study, 'optuna_searches/study.pkl')