User:So9q
I'm interested in functions for Swedish and other languages I know.
Shortcuts
Generic helper functions
Add string suffix if not already present
- add suffix "ns" to string if it does not end with "ns" (Z18066) ✓
- add suffix "en" to string if it does not end with "en" (Z18050) ✓
- add suffix "ets" to string if it does not end with "ets" (Z18042) ✓
- add suffix "ens" to string if it does not end with "ens" (Z18039) ✓
- add suffix "enas" to string if it does not end with "enas" (Z18036) ✓
- add suffix "s" to string if it does not already end with "s" (Z18020) ✓
- add suffix "ts" to string if it does not already ends with "ts" (Z18017) ✓
- add suffix "nas" to string if it does not already end with "nas" (Z17952) ✓
- add suffix "rnas" to string if it does not end with "rnas" (Z17942) ✓
- add suffix "rna" to string if it does not end with "rna" (Z17939) ✓
- add suffix "na" to string if it does not end with "na" (Z17946) ✓
- add suffix "r" to string if it does not end with "r" (Z17749) ✓
- add suffix "t" to string if it does not end with "t" (Z17904) ✓
- add suffix "a" to string if it does not end in "a" (Z17948) ✓
- add suffix "n" to string if it does not already end with "n" (Z17791) ✓
- add suffix to string if it does not already end with the suffix (Z17973) ✓
Replace suffix
- replace suffix "a" with "t" (Z18148) ✓
- replace suffix "a" with "ors" (Z18092) ✓
- replace suffix "a" with "ons" (Z18026) ✓
- replace suffix "a" with "on" (Z17827) ✓
- replace suffix "a" with "orna" (Z17915) ✓
- replace suffix "a" with "ornas" (Z17918) ✓
- Z17986 ✓ duplicate, RFD open
Swedish
All functions with ✓ below have been created and implemented by me. :)
Verbs
Helper functions
- (Swedish verb) has imperative? (Z18166)
- has supine
Group 1
E.g. titta -> tittar
- Infinitive titta string identity (Z11602)
- Imperative string identity (Z11602)
- Presens tittar add suffix "r" to string if it does not end with "r" (Z17749)
- Preteritum tittade add suffix "de" to string if it does not already end with "de" (Z18142)
- Supine tittat add suffix "t" to string if it does not end with "t" (Z17904)
Group 2
E.g. köra -> kör, ringa -> ringer, söka -> sökte
de verb som slutar på -te i preteritum är de som slutar på en av följande bokstäver: k, p, t, s eller x.
- Infinitive string identity (Z11602)
- Imperative Swedish verb, group 2, imperative (Z18145) ✓
- Presens Swedish verb, group 2, imperative (Z18145) ✓
- Preteritum add suffix "de" to string if it does not already end with "de" (Z18142) ✓
- Supine replace suffix "a" with "t" (Z18148) ✓
Group 3
E.g. bo -> bor/bodde/bott
- Infinitive string identity (Z11602)
- Imperative string identity (Z11602)
- Presens add suffix "r" to string if it does not end with "r" (Z17749)
- Preteritum add suffix "dde" if string does not already end with "dde" (Z18151)
- Supine add suffix "tt" if string does not end with "tt" (Z18154)
Group 4
Oregelbundna
E.g. dricka -> dricker/drack/druckit E.g. böra -> bör/borde/bort
- Infinitive string identity (Z11602)
- Imperative Swedish verb, group 2, imperative (Z18145)
- Present replace suffix "a" with "er" (Z18157)
- Preterite Swedish verb, group 4, present -er/-r/-an (Z18175)
- Supine Swedish verb, group 4, supine, umlaut + it/-it/-tt (Z18163)
Nouns
The purpose of these declension functions is to cover all nouns in Swedish. The first six classes are borrowed from Svenska Akademiens språklära. Unfortunately none of them account for the nouns in the seventh - ninth classes below.
Since a few nouns have no plural forms and a few have multiple plural forms we recommend to call the helper functions below first to avoid erroneous output.
Swedish noun helper functions
- (Swedish noun) interfix "e" needed in compound? (Z18238) ✓
- (Swedish noun) interfix "s" needed in compound? (Z18220) ✓
- (Swedish noun) interfix "u" needed in compound? (Z18226) ✓
- (Swedish noun) interfix "o" needed in compound? (Z18233) ✓
- Swedish noun root in first morpheme in combinations (Z17727) ✓
- is Swedish noun with multiple plural forms? (Z18002) ✓
- is Swedish noun with no plural forms? (Z18006) ✓
First declension
E.g. gata -> gator
Case | Singular | Plural | ||
---|---|---|---|---|
Indefinite | Definite | Indefinite | Definite | |
Nominative | - | Swedish noun, first declension, definite singular, -n (Z17725) ✓ | replace suffix "a" with "or" (Z17703) ✓ | replace suffix "a" with "orna" (Z17915) ✓ |
Genitive | add suffix "s" to string if it does not already end with "s" (Z18020) ✓ | add suffix "ns" to string if it does not end with "ns" (Z18066) ✓ | replace suffix "a" with "ors" (Z18092) ✓ | replace suffix "a" with "ornas" (Z17918) ✓ |
Second declension
E.g. växel -> växlar
Third declension
E.g. student -> studenter
Fourth declension
E.g. fiende -> fiender
Fifth declension
E.g äpple -> äpplen
Sixth declension
E.g. lärare, bord
Seventh (vovel shortening only) declension
I invented this class to account for mus -> möss and similar nouns.
Eigth declension
I invented this class to account for öga -> ögon and similar nouns.
Case | Singular | Plural | ||
---|---|---|---|---|
Indefinite | Definite | Indefinite | Definite | |
Nominative | - | add suffix "t" to string if it does not end with "t" (Z17904) ✓ | replace suffix "a" with "on" (Z17827) ✓ | replace suffix "a" with "onen" (Z18012) ✓ |
Genitive | add suffix "s" to string if it does not already end with "s" (Z18020) ✓ | add suffix "ts" to string if it does not already ends with "ts" (Z18017) ✓ | replace suffix "a" with "ons" (Z18026) ✓ | replace suffix "a" with "onens" (Z18023) ✓ |
Ninth declension
I invented this class to account for huvud -> huvuden and similar nouns.
Sources
Other functions
- (!) carbon dioxide emissions of MK1 petrol car journey (Z18364): Takes liter of fuel as input and outputs kilogram of carbon dioxide equivalents (kg CO2e) (source for CO2E foe different fuel types)
- electric car cost per km driven
- cost of fossil fuel car journey (litres) (Z18181)
Affected by bugs or missing features
Affected by https://phabricator.wikimedia.org/T343593
- Wikidata entity JSON has entity-type claim? (Z18319): Check if the claim with a given property/entity type exist in the input JSON of an entity
- Wikidata entity JSON has string-type claim? (Z18331): Checks whether the entity data contains a specific claim.
- Distance between two QIDs (SI-unit output in meters) (Wikidata lookup and float type needed) (Z18363): Lookup coordinates on Qids and calculate the distance. Output in meters.
- is valid Wikidata entity identifier? (Z18336): Check a string and see it it validates to a Qid, Lid, Form id, Sense id or Pid
- Is valid Qid (Z10696): Checks if a given string is a valid Qid in Wikidata i.e. if it resolves to an item. by Ainali
- (!) get language item from Lexeme JSON (Z10041): (!) approximates mw.wikibase.lexeme.entity.lexeme:getLanguage by Mahir
- (!) get lemma string from Lexeme JSON (Z10037): (!) approximates mw.wikibase.lexeme.entity.lexeme:getLemma(languageCode) by Mahir
- (!) get gloss string from sense JSON (Z10499): (!) approximates mw.wikibase.lexeme.entity.sense:getGloss(languageCode) by Mahir
- (!) get lexical category from Lexeme JSON (Z10222): (!) approximates mw.wikibase.lexeme.entity.lexeme:getLexicalCategory by Mahir
- (!) get representation string from form JSON (Z10495): (!) approximates mw.wikibase.lexeme.entity.form:getRepresentation(languageCode) by Mahir
- (!) lexeme form JSON has desired grammatical feature (Z10225): (!) approximation of mw.wikibase.lexeme.entity.form:hasGrammaticalFeature( itemId ) by Mahir
Affected by missing float type
- (!) carbon dioxide emissions of journey (Z18421): Outputs kilogram of carbon dioxide equivalents (kg CO2e) based on 2 inputs.
- (!) carbon dioxide emissions of MK1 diesel car journey (Z18391): Takes liter of fuel as input and outputs kilogram of carbon dioxide equivalents (kg CO2e)
- (!) carbon dioxide emissions of MK1 petrol car journey (Z18364): Takes liter of fuel as input and outputs kilogram of carbon dioxide equivalents (kg CO2e)
- (!) carbon dioxide emissions of ethanol E85 car journey (Z18406): Takes liter of fuel as input and outputs kilogram of carbon dioxide equivalents (kg CO2e), see Q57084901
- (!) carbon dioxide emissions of biogas (CNG) car journey (Z18409): Takes kg of gas as input and outputs kilogram of carbon dioxide equivalents (kg CO2e)
- (!) carbon dioxide emissions of electric car journey (Sweden) (Z18412): Takes kWh as input and outputs kilogram of carbon dioxide equivalents (kg CO2e)
- (!) carbon dioxide emissions of fatty acid methyl ester car journey (Z18415): Takes liter of fuel as input and outputs kilogram of carbon dioxide equivalents (kg CO2e)
- (!) carbon dioxide emissions of HVO car journey (Z18418): Takes liter of fuel as input and outputs kilogram of carbon dioxide equivalents (kg CO2e)
- (!) carbon dioxide emissions of train journey (Z18424): This is based on estimations. See the talk page for details.
- (!) distance between two points on earth in kilometers (Haversine) (Z18362): This takes 2 coordinates and output the result in kilometers
- (!) miles to kilometers (Z18428): Convert between length units.
- (!) miles to meters (Z18450): Conversion from length unit commonly used in the UK and USA.
- (!) Scandinavian miles to kilometers (Z18431): Convert between length units.
- (!) meters to kilometers (Z18353): no description
- (!) meters to miles (Z18447): Conversion to length unit commonly used in the UK and USA.
- (!) inch to feet (Z18456): Conversion among length units commonly used in the UK and USA.
- (!) centimeter to inch (Z18453): Conversion to a length unit commonly used in the UK and USA.
- (!) inches to feet and inches (Z18459): Conversion between imperial units
Affected by missing Wikidata connection
- noun lexeme is endocentric compound? (Z18317): Accept a Lexeme ID, look it up in Wikidata and return True if P31→ statement is found, False if not. (takes LID, lookup in Wikidata and return True if P31-statement is found, False if not.
- noun lexeme is exocentric compound? (takes LID, lookup in Wikidata and return True if P31-statement is found, False if not.
Notes
{{section resolved|1=~~~~}}
{{Welcome/lang|user=|welcominguser=|1=~~~~}}