mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-21 19:45:23 -04:00
#2 rozdzielenie liczby dla form grzecznościowych i dla pozostałych form
This commit is contained in:
parent
3a3828a4c2
commit
1601648caf
@ -2,7 +2,7 @@
|
||||
<div v-if="sources.length">
|
||||
<h2 class="h4">
|
||||
<Icon v="books"/>
|
||||
Przykłady z literatury i prasy:
|
||||
Przykłady z literatury, prasy, filmów i seriali:
|
||||
</h2>
|
||||
|
||||
<LiteratureMenu/>
|
||||
|
@ -33,6 +33,12 @@
|
||||
<span v-else>{{part.str}}</span>
|
||||
</span>
|
||||
</li>
|
||||
<li v-for="example in examplesHonorific" class="my-1">
|
||||
<span v-for="part in example.parts[selectedTemplate.pluralHonorific]">
|
||||
<strong v-if="part.variable">{{selectedTemplate.morphemes[part.str]}}</strong>
|
||||
<span v-else>{{part.str}}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
@ -64,13 +70,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { examples, templates } from "~/src/data";
|
||||
import { examples, examplesHonorific, templates } from "~/src/data";
|
||||
import { buildTemplate, getTemplate } from "../src/buildTemplate";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
examples: examples,
|
||||
examplesHonorific: examplesHonorific,
|
||||
templates: templates,
|
||||
getTemplate: getTemplate,
|
||||
|
||||
|
@ -66,26 +66,32 @@
|
||||
<p>
|
||||
Przykłady użycia w zdaniu:
|
||||
</p>
|
||||
<ul>
|
||||
<li v-for="example in examples">
|
||||
<span v-for="part in example.parts[selectedTemplate.plural]">
|
||||
<input v-if="part.variable" v-model="selectedTemplate.morphemes[part.str]"
|
||||
:class="['form-control form-input p-0', {'active': selectedMorpheme === part.str}]"
|
||||
:size="selectedTemplate.morphemes[part.str] ? selectedTemplate.morphemes[part.str].length : 0"
|
||||
maxlength="7"
|
||||
@focus="selectedMorpheme = part.str"
|
||||
@blur="selectedMorpheme = ''"
|
||||
/>
|
||||
<span v-else>{{part.str}}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="my-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="plural" v-model="selectedTemplate.plural">
|
||||
<label class="custom-control-label" for="plural">Liczba mnoga</label>
|
||||
<template v-for="(typeExamples, isHonorific) in {0: examples, 1: examplesHonorific}">
|
||||
<ul>
|
||||
<li v-for="example in typeExamples">
|
||||
<span v-for="part in example.parts[bool(isHonorific) ? selectedTemplate.pluralHonorific : selectedTemplate.plural]">
|
||||
<input v-if="part.variable" v-model="selectedTemplate.morphemes[part.str]"
|
||||
:class="['form-control form-input p-0', {'active': selectedMorpheme === part.str}]"
|
||||
:size="selectedTemplate.morphemes[part.str] ? selectedTemplate.morphemes[part.str].length : 0"
|
||||
maxlength="7"
|
||||
@focus="selectedMorpheme = part.str"
|
||||
@blur="selectedMorpheme = ''"
|
||||
/>
|
||||
<span v-else>{{part.str}}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="my-3">
|
||||
<div class="custom-control custom-switch" v-if="bool(isHonorific)">
|
||||
<input type="checkbox" class="custom-control-input" id="pluralHonorific" v-model="selectedTemplate.pluralHonorific">
|
||||
<label class="custom-control-label" for="pluralHonorific">Liczba mnoga <Icon v="level-up"/></label>
|
||||
</div>
|
||||
<div class="custom-control custom-switch" v-else>
|
||||
<input type="checkbox" class="custom-control-input" id="plural" v-model="selectedTemplate.plural">
|
||||
<label class="custom-control-label" for="plural">Liczba mnoga <Icon v="level-up"/></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="card-footer" v-if="customise && link">
|
||||
<div class="input-group my-2">
|
||||
@ -157,7 +163,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { examples, templates } from "~/src/data";
|
||||
import { examples, examplesHonorific, templates } from "~/src/data";
|
||||
import Compressor from "../src/compressor";
|
||||
import ClipboardJS from 'clipboard';
|
||||
import { getTemplate } from "../src/buildTemplate";
|
||||
@ -166,6 +172,7 @@
|
||||
data() {
|
||||
return {
|
||||
examples: examples,
|
||||
examplesHonorific: examplesHonorific,
|
||||
templates: templates,
|
||||
getTemplate: getTemplate,
|
||||
|
||||
@ -216,6 +223,9 @@
|
||||
methods: {
|
||||
focusLink() {
|
||||
setTimeout(_ => this.$refs.link.select(), 100);
|
||||
},
|
||||
bool(v) {
|
||||
return !!parseInt(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,9 +142,10 @@ const escape = s => {
|
||||
}
|
||||
|
||||
export class Template {
|
||||
constructor (description, morphemes, plural, sources = [], aliases = [], history = null) {
|
||||
constructor (description, morphemes, plural, pluralHonorific, sources = [], aliases = [], history = null) {
|
||||
this.description = description;
|
||||
this.morphemes = morphemes
|
||||
this.pluralHonorific = pluralHonorific;
|
||||
this.plural = plural;
|
||||
this.sources = sources;
|
||||
this.aliases = aliases;
|
||||
@ -160,7 +161,7 @@ export class Template {
|
||||
}
|
||||
|
||||
clone() {
|
||||
return new Template(this.description, clone(this.morphemes), this.plural);
|
||||
return new Template(this.description, clone(this.morphemes), this.plural, this.pluralHonorific);
|
||||
}
|
||||
|
||||
equals(other) {
|
||||
@ -171,6 +172,7 @@ export class Template {
|
||||
return [
|
||||
...Object.values(this.morphemes).map(s => escape(s)),
|
||||
this.plural ? 1 : 0,
|
||||
this.pluralHonorific ? 1 : 0,
|
||||
escape(this.description),
|
||||
];
|
||||
}
|
||||
@ -180,16 +182,16 @@ export class Template {
|
||||
}
|
||||
|
||||
static from(data) {
|
||||
if (data.length === morphemes.length + 1) {
|
||||
if (data.length === morphemes.length + 2) {
|
||||
data.push('');
|
||||
}
|
||||
|
||||
if (data.length !== morphemes.length + 2
|
||||
if (data.length !== morphemes.length + 3
|
||||
|| data[0].length === 0
|
||||
|| data[data.length - 1].length > 48
|
||||
|| data[data.length - 2].length === 0
|
||||
|| ![0, 1].includes(parseInt(data[morphemes.length]))
|
||||
|| data.slice(1, data.length - 2).filter(s => s.length > 7).length
|
||||
|| ![0, 1].includes(parseInt(data[morphemes.length + 1]))
|
||||
|| data.slice(1, data.length - 3).filter(s => s.length > 7).length
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
@ -199,6 +201,6 @@ export class Template {
|
||||
m[morphemes[parseInt(i)]] = data[parseInt(i)];
|
||||
}
|
||||
|
||||
return new Template(data[data.length - 1], m, parseInt(data[morphemes.length]) === 1)
|
||||
return new Template(data[data.length - 1], m, parseInt(data[morphemes.length]) === 1, parseInt(data[morphemes.length + 1]) === 1)
|
||||
}
|
||||
}
|
||||
|
34
src/data.js
34
src/data.js
@ -13,7 +13,11 @@ export const examples = [
|
||||
Example.parse('Po{verb_go}{verb_middle}m z {pronoun_i} do szkoły.|Po{verb_go}śmy z {pronoun_i} do szkoły.'),
|
||||
Example.parse('Rozmawialiśmy o {pronoun_l} ostatnio.'),
|
||||
Example.parse('Każd{adjective_n} z nich chciał{verb_end_about} czego innego.|Wszys{pronoun_all} z nich chci{verb_middle} czego innego.'),
|
||||
Example.parse('To miło, że nas {honorific} odwiedził{verb_end_about}.|To miło, że nas {honorific} odwiedzi{verb_end_about}.'),
|
||||
];
|
||||
|
||||
export const examplesHonorific = [
|
||||
Example.parse('To miło, że nas {honorific} odwiedza.|To miło, że nas {honorific} odwiedzają.'),
|
||||
Example.parse('Czy będzie {honorific} kontynuować subskrypcję?|Czy będą {honorific} kontynuować subskrypcję?'),
|
||||
];
|
||||
|
||||
const zapachKosmosu = new Book(
|
||||
@ -77,7 +81,7 @@ export const templates = {
|
||||
'verb_go': 'szedł',
|
||||
'verb_o': 'ó',
|
||||
'honorific': 'pan',
|
||||
}, false, [
|
||||
}, false, false, [
|
||||
confirmatio,
|
||||
perfekcyjna,
|
||||
silaNizsza,
|
||||
@ -103,7 +107,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pani',
|
||||
}, false, [
|
||||
}, false, false, [
|
||||
smoczaPerla,
|
||||
zapachKosmosu,
|
||||
new Book('Ann Leckie', 'Zabójcza sprawiedliwość', 'tłum. Danuta Górska', 2015, [], 'postać niebinarna używająca form żeńskich'),
|
||||
@ -129,7 +133,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pań',
|
||||
}, false, [
|
||||
}, false, false, [
|
||||
new Article(
|
||||
'Małgorzata Goślińska',
|
||||
'Zrobimy z ciebie mężczyznę',
|
||||
@ -259,7 +263,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pań',
|
||||
}, false, [], []),
|
||||
}, false, false, [], []),
|
||||
'ono/jejgo': new Template('Rodzaj nijaki', {
|
||||
'pronoun_n': 'ono',
|
||||
'pronoun_g': 'jejgo',
|
||||
@ -279,7 +283,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pań',
|
||||
}, false, [], []),
|
||||
}, false, false, [], []),
|
||||
'ono/jeno': new Template('Neorodzaj gramatyczny, z elementami rodzaju nijakiego i dukaizmów', {
|
||||
'pronoun_n': 'ono',
|
||||
'pronoun_g': 'jeno',
|
||||
@ -299,7 +303,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pań',
|
||||
}, false, [], []),
|
||||
}, false, false, [], []),
|
||||
'ono/jenu': new Template('Rodzaj nijaki z dukaizmami zamiast form męskich', {
|
||||
'pronoun_n': 'ono',
|
||||
'pronoun_g': 'jenu',
|
||||
@ -319,7 +323,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pań',
|
||||
}, false, [], []),
|
||||
}, false, false, [], []),
|
||||
onu: new Template('Rodzaj postpłciowy, dukaizmy', {
|
||||
'pronoun_n': 'onu',
|
||||
'pronoun_g': 'jenu',
|
||||
@ -339,7 +343,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'panu',
|
||||
}, false, [
|
||||
}, false, false, [
|
||||
new Article(
|
||||
'Rozmowa Ewy Tomaszewicz z Loë Fjorsigviss i Magdaleną Stonawską',
|
||||
'Tęcza w fandomie',
|
||||
@ -386,7 +390,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'panæ',
|
||||
}, false, [], ['onæ/jæ']),
|
||||
}, false, false, [], ['onæ/jæ']),
|
||||
oni: new Template('Formy męskoosobowe liczby mnogiej', {
|
||||
'pronoun_n': 'oni',
|
||||
'pronoun_g': 'ich',
|
||||
@ -406,7 +410,7 @@ export const templates = {
|
||||
'verb_go': 'szli',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'państwo',
|
||||
}, true, [
|
||||
}, true, true, [
|
||||
new Book('Karolina Fedyk', 'Skrzydła', '', 2019),
|
||||
new Book('Weronika Mamuna', 'Obca, która była', 'w: „Tęczowe i fantastyczne”', 2020),
|
||||
new Book('Agnieszka Żak', 'Dorastanie w czasach cyborgizacji', 'w: „Tęczowe i fantastyczne”', 2020),
|
||||
@ -430,7 +434,7 @@ export const templates = {
|
||||
'verb_go': 'szły',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'państwo',
|
||||
}, true, [
|
||||
}, true, true, [
|
||||
new Book('Artur Nowrot', 'Smocze dziecko', 'w: „Tęczowe i fantastyczne”', 2020),
|
||||
], ['one/ich']),
|
||||
onx: new Template('Formy z iksem', {
|
||||
@ -452,7 +456,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'panx',
|
||||
}, false, [], ['onx/jex']),
|
||||
}, false, false, [], ['onx/jex']),
|
||||
on_: new Template('Formy z podkreślnikiem', {
|
||||
'pronoun_n': 'on_',
|
||||
'pronoun_g': 'je_',
|
||||
@ -472,7 +476,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pan_',
|
||||
}, false, [
|
||||
}, false, false, [
|
||||
new Book('R.S. Benedict', 'Moje angielskie imię', 'w: „Nowa Fantastyka” 3/2019', 2019),
|
||||
], ['on_/je_']),
|
||||
onø: new Template('Formy z samogłoską nosową', {
|
||||
@ -514,7 +518,7 @@ export const templates = {
|
||||
'verb_go': 'szł',
|
||||
'verb_o': 'o',
|
||||
'honorific': 'pań',
|
||||
}, false, [
|
||||
}, false, false, [
|
||||
new Book(
|
||||
'Greg Egan',
|
||||
'Stan wyczerpania',
|
||||
|
Loading…
x
Reference in New Issue
Block a user