the Android App now show the valency patterns for verbs in English, Bulgarian and Swedish

This commit is contained in:
kr.angelov
2013-11-28 12:48:55 +00:00
parent ab90b3c7ef
commit 35580255c3
6 changed files with 101 additions and 39 deletions

View File

@@ -160,15 +160,23 @@
<cat>V2</cat>
<cat>V3</cat>
<cat>V2V</cat>
<cat>V2S</cat>
<cat>V2Q</cat>
<cat>V2A</cat>
<cat>VV</cat>
<cat>VS</cat>
<cat>VQ</cat>
<cat>VA</cat>
<tag>гл</tag>
<template>
<h1>Глагол от несвършен вид</h1>
<h1>Глагол</h1>
<lin>Feat<cat/> (<lemma/>)</lin>
<h2>Несвършен вид</h2>
<h3>Изявително наклонение</h3>
<h2>Изявително наклонение</h2>
<h3>Сегашно време</h3>
<h4>Сегашно време</h4>
<table class="forms-table" rules="all">
<tr>
<th></th>
@@ -192,7 +200,7 @@
</tr>
</table>
<h3>Минало свършено време (аорист)</h3>
<h4>Минало свършено време (аорист)</h4>
<table class="forms-table" rules="all">
<tr>
<th></th>
@@ -216,7 +224,7 @@
</tr>
</table>
<h3>Минало несвършено време (имперфект)</h3>
<h4>Минало несвършено време (имперфект)</h4>
<table class="forms-table" rules="all">
<tr>
<th></th>
@@ -240,7 +248,7 @@
</tr>
</table>
<h2>Повелително наклонение</h2>
<h3>Повелително наклонение</h3>
<table class="forms-table" rules="all">
<tr>
<th>ед.ч.</th>
@@ -251,10 +259,10 @@
<td><form>s Imperf (VImperative Pl)</form></td>
</tr>
</table>
<h2>Причастия (отглаголни прилагателни)</h2>
<h3>Минало страдателно причастие</h3>
<h3>Причастия (отглаголни прилагателни)</h3>
<h4>Минало страдателно причастие</h4>
<table class="forms-table" rules="all">
<tr>
<th rowspan="7">ед.ч.</th>
@@ -299,7 +307,7 @@
</tr>
</table>
<h3>Минало свършено деятелно причастие</h3>
<h4>Минало свършено деятелно причастие</h4>
<table class="forms-table" rules="all">
<tr>
<th rowspan="7">ед.ч.</th>
@@ -344,7 +352,7 @@
</tr>
</table>
<h3>Минало несвършено деятелно причастие</h3>
<h4>Минало несвършено деятелно причастие</h4>
<table class="forms-table" rules="all">
<tr>
<th rowspan="7">ед.ч.</th>
@@ -388,8 +396,8 @@
<td><form>s Imperf (VPluPerfect (APl Def))</form></td>
</tr>
</table>
<h3>Сегашно деятелно причастие</h3>
<h4>Сегашно деятелно причастие</h4>
<table class="forms-table" rules="all">
<tr>
<th rowspan="7">ед.ч.</th>
@@ -433,14 +441,11 @@
<td><form>s Imperf (VPresPart (APl Def))</form></td>
</tr>
</table>
<h2>Деепричастие (отглаголно наречие)</h2>
<p><form>s Imperf VGerund</form></p>
<h1>Глагол от свършен вид</h1>
<h2>Изявително наклонение</h2>
<h3>Сегашно време</h3>
<h2>Свършен вид</h2>
<h3>Изявително наклонение</h3>
<h4>Сегашно време</h4>
<table class="forms-table" rules="all">
<tr>
<th></th>
@@ -463,8 +468,8 @@
<td><form>s Perf (VPres Pl P3)</form></td>
</tr>
</table>
<h3>Минало свършено време (аорист)</h3>
<h4>Минало свършено време (аорист)</h4>
<table class="forms-table" rules="all">
<tr>
<th></th>
@@ -487,8 +492,8 @@
<td><form>s Perf (VAorist Pl P3)</form></td>
</tr>
</table>
<h3>Минало несвършено време (имперфект)</h3>
<h4>Минало несвършено време (имперфект)</h4>
<table class="forms-table" rules="all">
<tr>
<th></th>
@@ -512,7 +517,7 @@
</tr>
</table>
<h2>Повелително наклонение</h2>
<h3>Повелително наклонение</h3>
<table class="forms-table" rules="all">
<tr>
<th>ед.ч.</th>
@@ -524,9 +529,9 @@
</tr>
</table>
<h2>Причастия (отглаголни прилагателни)</h2>
<h3>Минало свършено деятелно причастие</h3>
<h3>Причастия (отглаголни прилагателни)</h3>
<h4>Минало свършено деятелно причастие</h4>
<table class="forms-table" rules="all">
<tr>
<th rowspan="7">ед.ч.</th>
@@ -571,7 +576,7 @@
</tr>
</table>
<h3>Минало несвършено деятелно причастие</h3>
<h4>Минало несвършено деятелно причастие</h4>
<table class="forms-table" rules="all">
<tr>
<th rowspan="7">ед.ч.</th>
@@ -615,7 +620,7 @@
<td><form>s Perf (VPluPerfect (APl Def))</form></td>
</tr>
</table>
<h1>Отглаголно съществително</h1>
<table class="forms-table" rules="all">
<tr>
@@ -637,6 +642,9 @@
<td><form>s Imperf (VNoun (NF Pl Def))</form></td>
</tr>
</table>
<h1>Деепричастие (отглаголно наречие)</h1>
<p><form>s Imperf VGerund</form></p>
</template>
</inflection>
</inflection_template>

View File

@@ -54,8 +54,13 @@
<cat>V2</cat>
<cat>V3</cat>
<cat>V2V</cat>
<cat>V2S</cat>
<cat>V2Q</cat>
<cat>V2A</cat>
<cat>VV</cat>
<cat>VS</cat>
<cat>VQ</cat>
<cat>VA</cat>
<tag>v</tag>
<template>
<h1>Verb</h1>

View File

@@ -79,11 +79,16 @@
<cat>V2</cat>
<cat>V3</cat>
<cat>V2V</cat>
<cat>VV</cat>
<cat>V2S</cat>
<cat>V2Q</cat>
<cat>V2A</cat>
<cat>VS</cat>
<cat>VQ</cat>
<cat>VA</cat>
<tag>v</tag>
<template>
<h1>Verb</h1>
<p><lin>Feat<cat/> (<lemma/>)</lin></p>
<table class="forms-table" rules="all">
<tr>
<th>infitive</th>
@@ -108,4 +113,34 @@
</table>
</template>
</inflection>
<inflection>
<cat>VV</cat>
<tag>v</tag>
<template>
<h1>Verb</h1>
<p><lin>Feat<cat/> (<lemma/>)</lin></p>
<table class="forms-table" rules="all">
<tr>
<th>infitive</th>
<td><form>s (VVF VInf)</form></td>
</tr>
<tr>
<th>present</th>
<td><form>s (VVF VPres)</form>&#160;<form>s VVPresNeg</form></td>
</tr>
<tr>
<th>past</th>
<td><form>s (VVF VPast)</form>&#160;<form>s VVPastNeg</form></td>
</tr>
<tr>
<th>past part.</th>
<td><form>s (VVF VPPart)</form></td>
</tr>
<tr>
<th>present part.</th>
<td><form>s (VVF VPresPart)</form></td>
</tr>
</table>
</template>
</inflection>
</inflection_template>

View File

@@ -132,11 +132,17 @@
<cat>V2</cat>
<cat>V3</cat>
<cat>V2V</cat>
<cat>V2S</cat>
<cat>V2Q</cat>
<cat>V2A</cat>
<cat>VV</cat>
<cat>VS</cat>
<cat>VQ</cat>
<cat>VA</cat>
<tag>v</tag>
<template>
<h1>Verb</h1>
<p><lin>Feat<cat/> (<lemma/>)</lin></p>
<table class="forms-table" rules="all">
<tr>
<th></th>

View File

@@ -89,6 +89,10 @@ public class LexicalEntryActivity extends ListActivity {
}
private void expand(View view, String lemma) {
String html = mTranslator.getInflectionTable(lemma);
if (html == null)
return;
ImageView arrow = (ImageView) view.findViewById(R.id.arrow);
arrow.setImageResource(R.drawable.close_arrow);
@@ -102,7 +106,6 @@ public class LexicalEntryActivity extends ListActivity {
((RelativeLayout) view).addView(inflectionView, params);
}
String html = mTranslator.getInflectionTable(lemma);
inflectionView.loadData(html, "text/html; charset=UTF-8", null);
expandedView = view;

View File

@@ -3,6 +3,7 @@ package org.grammaticalframework.ui.android;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.XmlResourceParser;
import android.text.TextUtils;
import android.util.Log;
import org.grammaticalframework.pgf.Concr;
@@ -213,14 +214,17 @@ public class Translator {
}
public String getInflectionTable(String lemma) {
String cat = getGrammar().getFunctionType(lemma).getCategory();
Concr targetLang = getConcr(getTargetLanguage().getConcrete());
if (!targetLang.hasLinearization(lemma))
return null;
int res = getTargetLanguage().getInflectionResource();
if (res == 0)
return "";
String cat = getGrammar().getFunctionType(lemma).getCategory();
Expr expr = Expr.readExpr(lemma);
Concr targetLang = getConcr(getTargetLanguage().getConcrete());
Map<String,String> lins = targetLang.tabularLinearize(expr);
XmlResourceParser parser = mContext.getResources().getXml(res);
StringBuilder builder = new StringBuilder();
@@ -277,7 +281,8 @@ public class Translator {
form = false;
} else if (state == 4 && lin && "lin".equals(parser.getName())) {
Expr expr2 = Expr.readExpr(abstrBuilder.toString());
builder.append(targetLang.linearize(expr2));
builder.append(TextUtils.htmlEncode(targetLang.linearize(expr2)));
lin = false;
emit = true;
} else if (state == 4 && emit) {
builder.append("</"+parser.getName()+">");
@@ -291,7 +296,7 @@ public class Translator {
if (form) {
String s = lins.get(parser.getText());
if (s != null)
builder.append(s);
builder.append(TextUtils.htmlEncode(s));
} else {
builder.append(parser.getText());
}