Permalink
Browse files

Implemented futuro simple and imperfecto

  • Loading branch information...
F1iX committed Nov 16, 2017
1 parent 9daf14e commit d2ff39a2c7f5ad384f0bf26620fa964771269bd6
@@ -0,0 +1,40 @@
package me.keppler.conjugator;

import java.util.HashMap;
import java.util.Map;

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

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

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
exceptions.put("haber", "habr"); // Yo habré = I will have
exceptions.put("hacer", "har"); // Yo haré = I will do
exceptions.put("poder","podr"); // Yo podré = I will be able to
exceptions.put("poner", "pondré"); // Yo pondré = I will put
exceptions.put("querer", "querr"); // Yo querré = I will want
exceptions.put("saber", "sabr"); // Yo sabré = I will know
exceptions.put("salir","saldr"); // Yo saldré = I will leave
exceptions.put("tener", "tendr"); // Yo tendré = I will have
exceptions.put("valer", "valdr"); // El valrá = It will be worth
exceptions.put("venir", "vendr"); // Yo vendré = I will come

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;
}
}
@@ -0,0 +1,52 @@
package me.keppler.conjugator;

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

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

if(verb.equals("ver")){ // ver = to see
verb = "ver*"; // Yo veía, Tu veías, El veía, Nosotros veíamos, Vosotros veíais, Ellos veían
}

// comer = to eat, pedir = to ask
forms[0] = verb.substring(0, verb.length() - 2) + "ía"; // Yo comía = I ate, Yo pedía = I asked
forms[1] = verb.substring(0, verb.length() - 2) + "ías"; // Tu comías = You ate, Tu pedías = You asked
forms[2] = verb.substring(0, verb.length() - 2) + "ía"; // Ella comía = She ate, El pedía = He asked
forms[3] = verb.substring(0, verb.length() - 2) + "íamos"; // Nosotros comíamos = We ate, Nosotros pedíamos = We asked
forms[4] = verb.substring(0, verb.length() - 2) + "íais"; // Vosotros comíais = You ate, Vosotros pedíais = You asked
forms[5] = verb.substring(0, verb.length() - 2) + "ían"; // Ellos comían = They ate, Ellas pedían = They asked

if (verb.endsWith("ar")) { // hablar = to speak
forms[0] = verb.substring(0, verb.length() - 2) + "aba"; // Yo hablaba = I spoke
forms[1] = verb.substring(0, verb.length() - 2) + "abas"; // Tu hablabas = You spoke
forms[2] = verb.substring(0, verb.length() - 2) + "aba"; // El hablaba = He spoke
forms[3] = verb.substring(0, verb.length() - 2) + "ábamos"; // Nosotros hablábamos = We spoke
forms[4] = verb.substring(0, verb.length() - 2) + "abais"; // Vosotros hablabais = You spoke
forms[5] = verb.substring(0, verb.length() - 2) + "aban"; // Ellos hablaban = They spoke
}

switch(verb){
case "ir": // ir = to go
forms[0] = "iba";
forms[1] = "ibas";
forms[2] = "iba";
forms[3] = "íbamos";
forms[4] = "ibais";
forms[5] = "iban";
break;
case "ser": // ser = to be
forms[0] = "era";
forms[1] = "eras";
forms[2] = "era";
forms[3] = "éramos";
forms[4] = "erais";
forms[5] = "eran";
break;
}
return forms;
}
}
@@ -81,7 +81,7 @@ void conjugate(){
tense = "Pretérito imperfecto";
example = "Yo hablaba = I spoke";
if(verb.length() > 1) {
//forms = Imperfect.get(verb);
forms = Imperfect.get(verb);
}
break;
case 3:
@@ -109,7 +109,7 @@ void conjugate(){
tense = "Futuro simple";
example = "Yo hablaré = I will speak";
if(verb.length() > 1) {
//forms = Future.get(verb);
forms = Future.get(verb);
}
break;
case 7:
@@ -10,71 +10,90 @@
public static String[] get(String verb){
String[] forms = new String[6];

// comer = eat
forms[0] = verb.substring(0, verb.length()-2) + "o";
forms[1] = verb.substring(0, verb.length()-2) + "es"; // differs for -ar
forms[2] = verb.substring(0, verb.length()-2) + "e"; // differs for -ar
forms[3] = verb.substring(0, verb.length()-2) + "emos"; // differs for -ir/-ar
forms[4] = verb.substring(0, verb.length()-2) + "éis"; // differs for -ir/-ar
forms[5] = verb.substring(0, verb.length()-2) + "en"; // differs for -ar
// comer = to eat
forms[0] = verb.substring(0, verb.length()-2) + "o"; // Yo como = I eat
forms[1] = verb.substring(0, verb.length()-2) + "es"; // Tu comes = You eat
forms[2] = verb.substring(0, verb.length()-2) + "e"; // El come = He eats
forms[3] = verb.substring(0, verb.length()-2) + "emos"; // Nosotros comemos = We eat
forms[4] = verb.substring(0, verb.length()-2) + "éis"; // Vosotros coméis = You eat
forms[5] = verb.substring(0, verb.length()-2) + "en"; // Ellos comen = They eat

if(verb.endsWith("ir")){ // asistir = attend
forms[3] = verb.substring(0, verb.length()-2) + "imos";
forms[4] = verb.substring(0, verb.length()-2) + "ís";
} else if(verb.endsWith("ar")){ // trabajar = work
forms[1] = verb.substring(0, verb.length()-2) + "as";
forms[2] = verb.substring(0, verb.length()-2) + "a";
forms[3] = verb.substring(0, verb.length()-2) + "amos";
forms[4] = verb.substring(0, verb.length()-2) + "áis";
forms[5] = verb.substring(0, verb.length()-2) + "an";
if(verb.endsWith("ir")){ // asistir = to attend
forms[3] = verb.substring(0, verb.length()-2) + "imos"; // Nosotros asistimos = We attend
forms[4] = verb.substring(0, verb.length()-2) + "ís"; // Vosotros asistís = You attend
} else if(verb.endsWith("ar")){ // trabajar = to work
forms[1] = verb.substring(0, verb.length()-2) + "as"; // Tu trabajas = You work
forms[2] = verb.substring(0, verb.length()-2) + "a"; // El trabaja = He works
forms[3] = verb.substring(0, verb.length()-2) + "amos"; // Nosotros trabajamos = We work
forms[4] = verb.substring(0, verb.length()-2) + "áis"; // Vosotros trabajáis = You work
forms[5] = verb.substring(0, verb.length()-2) + "an"; // Ellos trabajan = They work
}

if(verb.equals("ir")){
forms[0] = "voy";
forms[1] = "vas";
forms[2] = "va";
forms[3] = "vamos";
forms[4] = "vais";
forms[5] = "van";
} else if(verb.equals("dormir")){
forms[0] = "duermo";
forms[1] = "duermes";
forms[2] = "duerme";
forms[5] = "duermen";
} else if(verb.equals("haber")) {
forms[0] = "he";
forms[1] = "has";
forms[2] = "ha";
forms[3] = "habemos";
forms[5] = "han";
} else if(verb.equals("asir")){
forms[0] = "asgo";
} else if(verb.equals("caer")){
forms[0] = "caigo";
} else if(verb.equals("dar")){
forms[0] = "doy";
} else if(verb.equals("decir")){
forms[0] = "digo";
} else if(verb.equals("hacer")){
forms[0] = "hago";
} else if(verb.equals("poner")){
forms[0] = "pongo";
} else if(verb.equals("saber")){
forms[0] = "";
} else if(verb.equals("salir")){
forms[0] = "salgo";
} else if(verb.equals("tener")){
forms[0] = "tengo";
} else if(verb.equals("traer")){
forms[0] = "traigo";
} else if(verb.equals("valer")){
forms[0] = "valgo";
} else if(verb.equals("venir")){
forms[0] = "vengo";
} else if(verb.equals("ver")){
forms[0] = "veo";
switch(verb){
case "ir":
forms[0] = "voy";
forms[1] = "vas";
forms[2] = "va";
forms[3] = "vamos";
forms[4] = "vais";
forms[5] = "van";
break;
case "dormir":
forms[0] = "duermo";
forms[1] = "duermes";
forms[2] = "duerme";
forms[5] = "duermen";
break;
case "haber":
forms[0] = "he";
forms[1] = "has";
forms[2] = "ha";
forms[3] = "habemos";
forms[5] = "han";
break;
case "asir":
forms[0] = "asgo";
break;
case "caer":
forms[0] = "caigo";
break;
case "dar":
forms[0] = "doy";
break;
case "decir":
forms[0] = "digo";
break;
case "hacer":
forms[0] = "hago";
break;
case "poner":
forms[0] = "pongo";
break;
case "saber":
forms[0] = "";
break;
case "salir":
forms[0] = "salgo";
break;
case "tener":
forms[0] = "tengo";
break;
case "traer":
forms[0] = "traigo";
break;
case "valer":
forms[0] = "valgo";
break;
case "venir":
forms[0] = "vengo";
break;
case "ver":
forms[0] = "veo";
break;
}

//Todo: Further irregularities

return forms;
}
}
@@ -22,30 +22,43 @@
}
}

if(verb.equals("abrir")){
pastParticiple = "abierto";
} else if(verb.equals("cubrir")){
pastParticiple = "cubierto";
} else if(verb.equals("decir")){
pastParticiple = "dicho";
} else if(verb.equals("escribir")){
pastParticiple = "escrito";
} else if(verb.equals("hacer")){
pastParticiple = "hecho";
} else if(verb.equals("imprimir")){
pastParticiple = "impreso";
} else if(verb.equals("morir")){
pastParticiple = "muerto";
} else if(verb.equals("poner")){
pastParticiple = "puesto";
} else if(verb.equals("resolver")){
pastParticiple = "resuelto";
} else if(verb.equals("romper")){
pastParticiple = "roto";
} else if(verb.equals("ver")){
pastParticiple = "visto";
} else if(verb.equals("volver")){
pastParticiple = "vuelto";
switch(verb){
case "abrir":
pastParticiple = "abierto";
break;
case "cubrir":
pastParticiple = "cubierto";
break;
case "decir":
pastParticiple = "dicho";
break;
case "escribir":
pastParticiple = "escrito";
break;
case "hacer":
pastParticiple = "hecho";
break;
case "imprimir":
pastParticiple = "impreso";
break;
case "morir":
pastParticiple = "muerto";
break;
case "poner":
pastParticiple = "puesto";
break;
case "resolver":
pastParticiple = "resuelto";
break;
case "romper":
pastParticiple = "roto";
break;
case "ver":
pastParticiple = "visto";
break;
case "volver":
pastParticiple = "vuelto";
break;
}
// get conjugation of auxiliary verb haber
String[] forms = Present.get("haber");

0 comments on commit d2ff39a

Please sign in to comment.