Skip to content

Commit

Permalink
2.0.3
Browse files Browse the repository at this point in the history
💪
  • Loading branch information
CidQu committed Jul 25, 2022
1 parent 17668c0 commit 958aa05
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 106 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.3
* Changed READMEs and Added acikhack2022tddi tag to GitHub.

## 2.0.1
* Formatted files.
* Fixed GitHub things.
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Click this link for Turkish Readme: [Türkçe Sözlük](https://github.com/CidQu/sozluk/blob/main/READMETR.md)
Package Link: https://pub.dev/packages/sozluk

## Teknofest
This project built for Teknofest (Açıkhack) NPL tournament.
To access our presentation: [GoogleDriveTR]https://bit.ly/3z4ndI4
#acikhack2022tddi

## Features
You can use this package to find meanings, proverb and voiceUrl of Turkish Words.
Or you can simply just get everything in JSON format, that is an option too.
You can use this package to find meanings, proverb and voiceUrl of Turkish Words. Or you can check spellings, generate new words, find lemmas and so much more!

All of our informations comes from official *Turkish Language Association*. You can find legal rights below.
Click this link for Turkish Readme: [Türkçe Sözlük](https://github.com/CidQu/sozluk/blob/main/READMETR.md)
All of our informations comes from official *Turkish Language Association* and Zemberek. You can find legal rights below.
## Usage

First you need to add sozluk package to your dart file.
Expand Down
12 changes: 10 additions & 2 deletions READMETR.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Kütüphane Bağlantısı: [pub.dev]https://pub.dev/packages/sozluk

## Teknofest
Bu proje Teknofest Doğal Dil İşleme yarışması kapsamında hazırlanmıştır.
Proje sunumumuza ulaşmak için: [GoogleDrive]https://bit.ly/3z4ndI4

#acikhack2022tddi

## Sozluk
Flutter, TDK Paketi. Bu paketi kullanarak kolayca kelimelerin anlamlarını, atasözlerini ve ses dosyalarını bulabilirsin veya direk JSON halinde alabilirsiniz. Bu paket sozluk.gov.tr ve zemberek api'leri kullanılarak yapılmıştır.
Tüm bilgiler direkt olarak Türk Dil Kurumundan ve Zemberek'den gelmektedir. Yasal uyarı için aşağıda bulunan ek bilgiler kısmını okuyunuz.
Flutter, TDK Paketi. Bu paketi kullanarak kolayca kelimelerin anlamlarını, atasözlerini, ses dosyalarını bulabilir aynı zamanda da cümle içi kullanımı doğru mu? Alternatif hangi kelimeler kullanılabilir? Gibi bir çok soruya yanıt alabilirsiniz. Bu paket sozluk.gov.tr ve zemberek api'leri kullanılarak yapılmıştır.
Tüm bilgiler direkt olarak Türk Dil Kurumundan ve Zemberek'ten gelmektedir. Yasal uyarı için aşağıda bulunan ek bilgiler kısmını okuyunuz.

Click this link for Main Readme: [Main README File](https://github.com/CidQu/sozluk/blob/main/README.md)

Expand Down
9 changes: 5 additions & 4 deletions example/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:sozluk/sozluk.dart';
import 'dart:convert';

void anlam() async {
void sozluk() async {
var sozluk = Sozluk().dictionary;
var word = "Dalga";
var meaning = await sozluk.meaning(word);
Expand All @@ -19,11 +20,8 @@ void main() async {
var morphemes = "Verb+Fut+Past+A3sg";

var spelling_check = await sozluk.spellingCheck(word);

var generate_word = await sozluk.generateWord(word, morphemes);

var lemmas = await sozluk.lemmas(word);

var spelling_suggestions = await sozluk.spellingSuggestions(word);

print("Spelling Check: $spelling_check");
Expand All @@ -39,4 +37,7 @@ void zemberekBackend() async {
var jsonBody = '{"word": "$word"}';

var response = await sozluk.zemberekAPI(endpoint, jsonBody);
var jsonResponse = json.decode(response);
var result = jsonResponse['is_correct'];
print("Response: $result");
}
95 changes: 0 additions & 95 deletions lib/scr/anlam.dart
Original file line number Diff line number Diff line change
@@ -1,100 +1,5 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
/*
/// [SozlukTr] is a class for making HTTP requests to the SOZLUK API.
class SozlukTr {
/// [anlam] is a class for making HTTP requests to the SOZLUK API using the [word] parameter.
Future<String> anlam(String word) async {
try {
var res = await http.Client()
.get(Uri.parse('https://sozluk.gov.tr/gts?ara=$word'));
var body = res.body;
var decoded = jsonDecode(body);
var json = decoded[0];
var sozlukanlam = json["anlamlarListe"][0]["anlam"];
return sozlukanlam;
} catch (e) {
var hata = e.toString();
if (hata.contains('NoSuchMethodError')) {
var sozlukanlam = "HATA-001 - Bu kelimeye ait anlam bulunamadı.";
return sozlukanlam;
} else {
var sozlukanlam = e.toString();
return sozlukanlam;
}
}
}
/// [atasozu] is a class for making HTTP requests to the SOZLUK API using the [word] parameter.
Future<String> atasozu(String word) async {
try {
var res = await http.Client()
.get(Uri.parse('https://sozluk.gov.tr/gts?ara=$word'));
var body = res.body;
var decoded = jsonDecode(body);
var json = decoded[0];
var sozlukanlam = json["atasozu"][0]["madde"];
return sozlukanlam;
} catch (e) {
var hata = e.toString();
if (hata.contains('NoSuchMethodError')) {
var sozlukanlam = "HATA-002 - Bu kelimeye ait atasözü bulunamadı.";
return sozlukanlam;
} else {
var sozlukanlam = e.toString();
return sozlukanlam;
}
}
}
/// [sesUrl] is a class for making HTTP requests to the SOZLUK API using the [word] parameter.
Future<String> sesUrl(String word) async {
try {
var res = await http.Client()
.get(Uri.parse('https://sozluk.gov.tr/yazim?ara=$word'));
var body = res.body;
var decoded = jsonDecode(body);
var json = decoded[0];
var sozlukanlam = json["seskod"];
print('Voice Code: $sozlukanlam');
var anlamSesUrl = 'https://sozluk.gov.tr/ses/' + sozlukanlam + '.wav';
return anlamSesUrl;
} catch (e) {
var hata = e.toString();
if (hata.contains('NoSuchMethodError')) {
var sozlukanlam = "HATA-003 - Bu kelimeye ait ses bulunamadı.";
return sozlukanlam;
} else {
var sozlukanlam = e.toString();
return sozlukanlam;
}
}
}
/// [getJson] is a class for making HTTP requests to the SOZLUK API using the [word] parameter.
Future<String> getJson(String word) async {
try {
var res = await http.Client()
.get(Uri.parse('https://sozluk.gov.tr/gts?ara=$word'));
var body = res.body;
var decoded = jsonDecode(body);
var json = decoded[0];
var sozlukanlam = json;
return sozlukanlam.toString();
} catch (e) {
var hata = e.toString();
if (hata.contains('NoSuchMethodError')) {
var sozlukanlam =
"HATA-004 - Bu kelime bulunamadı, doğru yazıldığına emin olun.";
return sozlukanlam;
} else {
var sozlukanlam = e.toString();
return sozlukanlam;
}
}
}
}
*/

/// [Sozluk] is a class for making HTTP requests to the SOZLUK API.
class Sozluk {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sozluk
description: Sozluk is a community-driven Turkish dictionary powered by Turkish Language Association.
version: 2.0.1
version: 2.0.3

environment:
sdk: ">=2.15.1 <3.0.0"
Expand Down

0 comments on commit 958aa05

Please sign in to comment.