Skip to content

Commit

Permalink
Merge pull request #39 from monarch-initiative/czeck-it-out
Browse files Browse the repository at this point in the history
Add generation of prompts in czech
  • Loading branch information
ielis authored Nov 12, 2024
2 parents 621891e + e4f3436 commit 521d011
Show file tree
Hide file tree
Showing 13 changed files with 1,156 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public Integer call() throws Exception {
Utility.writeMissingTranslations(spanish.getMissingTranslations(),
missingTranslationsPath,"spanish.txt");

// Czech
PromptGenerator czech = utility.czech();
Utility.outputPromptsInternational(ppktFiles, "cs", czech);
Utility.writeMissingTranslations(czech.getMissingTranslations(),
missingTranslationsPath,"czech.txt");

// Dutch
PromptGenerator dutch = utility.dutch();
Utility.outputPromptsInternational(ppktFiles,"nl", dutch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public PromptGenerator chinese() {
return PromptGenerator.chinese(internationalMap.get("zh"));
}

public PromptGenerator czech() {
return PromptGenerator.czech(internationalMap.get("cs"));
}


public static String getFileName(String phenopacketID, String languageCode) {
return phenopacketID.replaceAll("[^\\w]","_") + "_" + languageCode + "-prompt.txt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.monarchinitiative.phenopacket2prompt.model.PhenopacketAge;
import org.monarchinitiative.phenopacket2prompt.model.PhenopacketSex;
import org.monarchinitiative.phenopacket2prompt.model.PpktIndividual;
import org.monarchinitiative.phenopacket2prompt.output.impl.czech.CzechPromptGenerator;
import org.monarchinitiative.phenopacket2prompt.output.impl.czech.PpktPhenotypicFeatureCzech;
import org.monarchinitiative.phenopacket2prompt.output.impl.english.EnglishPromptGenerator;
import org.monarchinitiative.phenopacket2prompt.output.impl.german.GermanPromptGenerator;
import org.monarchinitiative.phenopacket2prompt.output.impl.german.PpktPhenotypicfeatureGerman;
Expand Down Expand Up @@ -73,6 +75,11 @@ static PromptGenerator chinese(HpInternational international) {
return new ChinesePromptGenerator(pfgen);
}

static PromptGenerator czech(HpInternational international) {
PpktPhenotypicFeatureGenerator pfgen = new PpktPhenotypicFeatureCzech(international);
return new CzechPromptGenerator(pfgen);
}


/**
* The following structure should work for most other languages, but the function
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.monarchinitiative.phenopacket2prompt.output.impl.czech;

record Adjective(String nominativMale, String nominativFemale, String nominativNeutrum, String genitivMale, String genitivFemale, String genitivNeutrum) {

String nominativ(Genus genus) {
return switch (genus) {
case HE -> nominativMale;
case SHE -> nominativFemale;
case IT -> nominativNeutrum;
};
}

String genitiv(Genus genus) {
return switch (genus) {
case HE -> genitivMale;
case SHE -> genitivFemale;
case IT -> genitivNeutrum;
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.monarchinitiative.phenopacket2prompt.output.impl.czech;

class Adjectives {

static Adjective MALE = new Adjective("mužský", "mužská", "mužské", "mužského", "mužskej", "mužského");
static Adjective FEMALE = new Adjective("ženský", "ženská", "ženské", "ženského", "ženskej", "ženského");
static Adjective UNSPECIFIED = new Adjective("neuvedený", "neuvedená", "neuvedené", "neuvedeného", "neuvedenej", "neuvedeného");

private Adjectives() {
}
}
Loading

0 comments on commit 521d011

Please sign in to comment.