Permalink
Browse files

Added subjuntivo del presente, conditional and conditional perfect

  • Loading branch information...
F1iX committed Nov 20, 2017
1 parent 2a84d6a commit a52916634fa33f5518a7e5dcc2c6ad90707f0693
@@ -0,0 +1,23 @@
package me.keppler.conjugator;

/**
* Created by felix on 20/11/17.
*/

public class Conditional {
public static String[] get(String verb){
String[] forms = new String[6];

verb = Future.replaceExceptions(verb); // same irregularities as future tense

// hablar = to speak
forms[0] = verb + "ía"; // Yo hablaría = I would speak
forms[1] = verb + "ías"; // Tu hablarías = You would speak
forms[2] = verb + "ía"; // El hablaría = He would speak
forms[3] = verb + "íamos"; // Nosotros hablaríamos = We would speak
forms[4] = verb + "íais"; // Vosotros hablaríais = You (group) would speak
forms[5] = verb + "ían"; // Ellos hablarian = They would speak

return forms;
}
}
@@ -0,0 +1,19 @@
package me.keppler.conjugator;

/**
* Created by felix on 20/11/17.
*/

public class ConditionalPerfect {
public static String[] get(String verb){
String[] forms = Conditional.get("haber");
String pastParticiple = PresentPerfect.getPastParticiple(verb);

// build combined present perfect
for(int i = 0; i < forms.length; i++){
forms[i] = forms[i] + " " + pastParticiple;
}

return forms;
}
}
@@ -11,6 +11,20 @@
public static String[] get(String verb){
String[] forms = new String[6];

verb = replaceExceptions(verb);

// hablar = to speak
forms[0] = verb + "é"; // Yo hablaré = I will speak
forms[1] = verb + "ás"; // Tu hablarás = You will speak
forms[2] = verb + "á"; // El hablará = He will speak
forms[3] = verb + "emos"; // Nosotros hablaremos = We will speak
forms[4] = verb + "éis"; // Vosotros hablaréis = You (group) will speak
forms[5] = verb + "án"; // Ellos hablarán = They will speak

return forms;
}

public static String replaceExceptions(String verb){
Map<String,String> exceptions = new HashMap<String,String>();
exceptions.put("caber","cabr"); // Yo cabré = I will fit in
exceptions.put("decir", "dir"); // Yo diré = I will speak
@@ -27,14 +41,6 @@

if(exceptions.containsKey(verb)) verb = exceptions.get(verb); // replace infinitive with exception if applicant

// hablar = to speak
forms[0] = verb + "é"; // Yo hablaré = I will speak
forms[1] = verb + "ás"; // Tu hablarás = You will speak
forms[2] = verb + "á"; // El hablará = He will speak
forms[3] = verb + "emos"; // Nosotros hablaremos = We will speak
forms[4] = verb + "éis"; // Vosotros hablaréis = You (group) will speak
forms[5] = verb + "án"; // Ellos hablarán = They will speak

return forms;
return verb;
}
}
@@ -132,21 +132,21 @@ void conjugate(){
tense = "Subjuntivo del presente";
example = "...que yo hablo = ...that I speak";
if (verb.length() > 1) {
//forms = Present.get(verb);
forms = SubPresent.get(verb);
}
break;
case 5:
tense = "Conditional";
example = "Yo hablaría = I would speak";
if (verb.length() > 1) {
//forms = GoingToFuture.get(verb);
forms = Conditional.get(verb);
}
break;
case 6:
tense = "Conditional perfect";
example = "Yo habría hablado = I would have spoken";
if (verb.length() > 1) {
//forms = Future.get(verb);
forms = ConditionalPerfect.get(verb);
}
break;
}
@@ -6,6 +6,19 @@

public final class PresentPerfect {
public static String[] get(String verb) {
String pastParticiple = getPastParticiple(verb);
// get conjugation of auxiliary verb haber
String[] forms = Present.get("haber");

// build combined present perfect
for(int i = 0; i < forms.length; i++){
forms[i] = forms[i] + " " + pastParticiple;
}

return forms;
}

public static String getPastParticiple(String verb){
String pastParticiple;

if(verb.endsWith("ar")){ // trabajar -> trabajado
@@ -60,14 +73,6 @@
pastParticiple = "vuelto";
break;
}
// get conjugation of auxiliary verb haber
String[] forms = Present.get("haber");

// build combined present perfect
for(int i = 0; i < forms.length; i++){
forms[i] = forms[i] + " " + pastParticiple;
}

return forms;
return pastParticiple;
}
}
@@ -0,0 +1,86 @@
package me.keppler.conjugator;

/**
* Created by felix on 19/11/17.
*/

public class SubPresent {
public static String[] get(String verb){
String[] forms = new String[6];

if(verb.endsWith("car")){
verb = verb.substring(0, verb.length()-3) + "quar"; // ...que yo coloque = ...that I place
} else if(verb.endsWith("gar")){
verb = verb.substring(0, verb.length()-3) + "guar";
} else if(verb.endsWith("zar")){
verb = verb.substring(0, verb.length()-3) + "car"; // ...que yo rechace = ...that I reject
}
// Todo: Further "regular" irregularities if not already irregular in 1st person present

String firstSingularPresent = Present.get(verb)[0];

// comer = to eat
forms[0] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "a"; // ...que yo coma = ...that I eat
forms[1] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "as"; // ...que tu comas = ...that you eat
forms[2] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "coma"; // ...que el coma = ...that he eats
forms[3] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "comamos"; // ...que nosotros comamos = ...that we eat
forms[4] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "comáis"; // ...que vosotros comáis = ...that you eat
forms[5] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "coman"; // ...que ellos coman = ...that they eat

if(verb.endsWith("ar")){ // trabajar = to work
forms[0] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "e"; // ...que yo trabaje = ...that I work
forms[1] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "es"; // ...que tu trabajes = ...that you work
forms[2] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "e"; // ...que el trabaje = ...that he works
forms[3] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "emos"; // ...que nosotros trabajemos = ...that we work
forms[4] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "éis"; // ...que vosotros trabajéis = ...that you work
forms[5] = firstSingularPresent.substring(0, firstSingularPresent.length()-1) + "en"; // ...que ellos trabajen = ...that they work
}

switch(verb){
case "dar":
forms[0] = "";
forms[2] = "";
forms[4] = "deis";
break;
case "estar":
forms[0] = "esté";
forms[1] = "estés";
forms[2] = "esté";
forms[5] = "estén";
break;
case "haber":
forms[0] = "haya";
forms[1] = "hayas";
forms[2] = "haya";
forms[3] = "hayamos";
forms[4] = "hayáis";
forms[5] = "hayan";
break;
case "ir":
forms[0] = "vaya";
forms[1] = "vayas";
forms[2] = "vaya";
forms[3] = "vayamos";
forms[4] = "vayáis";
forms[5] = "vayan";
break;
case "saber":
forms[0] = "sepa";
forms[1] = "sepas";
forms[2] = "sepa";
forms[3] = "sepamos";
forms[4] = "sepáis";
forms[5] = "sepan";
break;
case "ser":
forms[0] = "sea";
forms[1] = "seas";
forms[2] = "sea";
forms[3] = "seamos";
forms[4] = "seáis";
forms[5] = "sean";
break;
}
return forms;
}
}

0 comments on commit a529166

Please sign in to comment.