es:manual:items:generativos:siette.util.corpus.dictionary
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
es:manual:items:generativos:siette.util.corpus.dictionary [2021/05/25 18:19] – root | es:manual:items:generativos:siette.util.corpus.dictionary [2021/11/07 21:44] (actual) – root | ||
---|---|---|---|
Línea 1: | Línea 1: | ||
===== siette.util.corpus.Dictionary ===== | ===== siette.util.corpus.Dictionary ===== | ||
- | La clase '' | + | La clase '' |
- | ==== Cosntructores | + | ==== Constructores |
<code java > | <code java > | ||
public Dictionary(String sURL, String separator) | public Dictionary(String sURL, String separator) | ||
Línea 15: | Línea 15: | ||
</ | </ | ||
- | Inicialmente para construir el objeto de la clase '' | + | Inicialmente para construir el objeto de la clase '' |
Tambien es posible crear el diccionario en blanco e inicializarlo posteriormente con el método '' | Tambien es posible crear el diccionario en blanco e inicializarlo posteriormente con el método '' | ||
Línea 26: | Línea 26: | ||
</ | </ | ||
- | Los diccionarios tienen dos modos de funcionamiento, | + | Los diccionarios tienen dos modos de funcionamiento, |
+ | |||
+ | <code java > | ||
+ | public boolean excludes(String termino) | ||
+ | </ | ||
+ | |||
+ | Excluye un '' | ||
==== selectDictionary ==== | ==== selectDictionary ==== | ||
Línea 32: | Línea 39: | ||
public Dictionary selectDictionary(String[] attPos, int modePos, String[] attNeg, int modeNeg) | public Dictionary selectDictionary(String[] attPos, int modePos, String[] attNeg, int modeNeg) | ||
public Dictionary selectDictionary(String[] attPos, String[] attNeg ) | public Dictionary selectDictionary(String[] attPos, String[] attNeg ) | ||
+ | public Dictionary selectDictionary(String[] attPos, String attNeg) | ||
public Dictionary selectDictionary(String[] att, int mode) | public Dictionary selectDictionary(String[] att, int mode) | ||
public Dictionary selectDictionary(String[] att) | public Dictionary selectDictionary(String[] att) | ||
Línea 41: | Línea 49: | ||
'' | '' | ||
- | '' | + | '' |
'' | '' | ||
- | '' | + | '' |
| | ||
Línea 56: | Línea 64: | ||
En este caso, el diccionario selecciona prendas que mezclen los colores rojo y azul, pero no sean de la talla '' | En este caso, el diccionario selecciona prendas que mezclen los colores rojo y azul, pero no sean de la talla '' | ||
- | Raramente la seleccion | + | Raramente la selección |
'' | '' | ||
Línea 67: | Línea 75: | ||
Dictionary d4 = selectDictionary(new String[] {" | Dictionary d4 = selectDictionary(new String[] {" | ||
- | | + | |
==== selectSet ==== | ==== selectSet ==== | ||
<code java > | <code java > | ||
public Set< | public Set< | ||
public Set< | public Set< | ||
+ | public Set< | ||
public Set< | public Set< | ||
public Set< | public Set< | ||
Línea 84: | Línea 93: | ||
public String[] selectAll(String[] attPos, int modePos, String[] attNeg, int modeNeg) | public String[] selectAll(String[] attPos, int modePos, String[] attNeg, int modeNeg) | ||
public String[] selectAll(String[] attPos, String[] attNeg ) | public String[] selectAll(String[] attPos, String[] attNeg ) | ||
+ | public String[] selectAll(String | ||
public String[] selectAll(String[] att, int mode) | public String[] selectAll(String[] att, int mode) | ||
public String[] selectAll(String[] att) | public String[] selectAll(String[] att) | ||
Línea 96: | Línea 106: | ||
<code java > | <code java > | ||
public String select(String[] attPos, String[] attNeg ) | public String select(String[] attPos, String[] attNeg ) | ||
+ | public String select(String | ||
public String select(String[] att) | public String select(String[] att) | ||
public String select(String att) | public String select(String att) | ||
Línea 105: | Línea 116: | ||
==== getAttributes ==== | ==== getAttributes ==== | ||
<code java > | <code java > | ||
- | public String[] getAttributes(String | + | public String[] getAttributes(String |
- | public String[] getAttributes(String | + | public String[] getAttributes(String |
- | public Set getAttributes(String text, Set subSet) | + | |
- | public Set getAttributesSet(String text) | + | |
</ | </ | ||
+ | Estas funciones devuelven todos los atributos asociados a un '' | ||
+ | |||
+ | <code java > | ||
+ | public Set getAttributesSet(String text, Set< | ||
+ | public Set getAttributesSet(String text) | ||
+ | </ | ||
+ | |||
+ | Igual que la anterior pero con conjuntos. | ||
+ | |||
+ | |||
+ | ==== toPattern ==== | ||
+ | <code java > | ||
+ | public static String cap(String st) | ||
+ | </ | ||
+ | |||
+ | Pone en mayúsculas la primera letra de una cadena de caracteres '' | ||
+ | |||
+ | <code java > | ||
+ | public static String toPattern(String in, boolean escape, int patternAlign) | ||
+ | public static String toPattern(String in, boolean escape) | ||
+ | public static String toPattern(String in) | ||
+ | </ | ||
+ | |||
+ | El propósito de estas funciones es construir un [[es: | ||
+ | |||
+ | | ||
+ | |||
+ | produce la salida | ||
+ | |||
+ | | ||
+ | |||
+ | Otra opciones, es construir el patrón de manera que conserve los caracteres especiales, para lo cual hay que precederlo del caracter de// | ||
+ | |||
+ | | ||
+ | |||
+ | produce la salida | ||
+ | |||
+ | | ||
+ | |||
+ | que es un patrón Siette valido. Finalmente tambien se puede construir un [[es: | ||
+ | |||
+ | | ||
+ | |||
+ | produce en la salida el patrón Siette: | ||
+ | |||
+ | | ||
+ | |||
+ | o bien | ||
+ | |||
+ | | ||
+ | |||
+ | produce en la salida el patrón Siette: | ||
+ | |||
+ | | ||
+ | |||
+ | El primer patrón daría como buena una respuesta que dijera simplemente '' | ||
+ | |||
+ | |||
+ | <code java > | ||
+ | public static String toPattern(Set set, int mode) | ||
+ | public static String toPattern(List aList, int mode) | ||
+ | public static String toPattern(String[] aString, int mode) | ||
+ | public static String toPatternAll(Set set) | ||
+ | public static String toPatternAll(List aList) | ||
+ | public static String toPatternAll(String[] aString) | ||
+ | public static String toPatternAny(Set set) | ||
+ | public static String toPatternAny(List aList) | ||
+ | public static String toPatternAny(String[] aString) | ||
+ | </ | ||
+ | |||
+ | Este conjunto de métodos devuelve un [[es: | ||
+ | |||
+ | | ||
+ | |||
+ | genera el siguiente [[es: | ||
+ | |||
+ | | ||
+ | |||
+ | que reconoce respuestas como: | ||
+ | |||
+ | | ||
+ | | ||
+ | azul rojo blanco | ||
+ | ... | ||
+ | |||
+ | Las versiones abreviadas de esta función imponen el modo en el propio nombre de la función, como por ejemplo | ||
+ | |||
+ | toPatternAny(new String[] {" | ||
+ | | ||
+ | que genera el patrón | ||
+ | |||
+ | rojo|azul|blanco | ||
+ | |||
+ | que acepta cualquiera de estas cadenas como respuesta. | ||
+ | |||
+ | ==== toText ==== | ||
+ | <code java > | ||
+ | public static String toText(String[] aString, int mode, String lang) | ||
+ | public static String toText(Set set, int mode, String lang) | ||
+ | public static String toTextAll(String[] aString, String lang) | ||
+ | public static String toTextAll(Set set, String lang) | ||
+ | public static String toTextAll(String s, String lang) | ||
+ | public static String toTextAny(String[] aString, String lang) | ||
+ | public static String toTextAny(Set set, String lang) | ||
+ | public static String toTextAny(String s, String lang) | ||
+ | </ | ||
+ | |||
+ | Los métodos '' | ||
+ | |||
+ | | ||
+ | |||
+ | devuelve la cadena de caracteres: | ||
+ | |||
+ | rojo, azul y blanco | ||
+ | |||
+ | Los métodos ' | ||
+ | |||
+ | | ||
+ | |||
+ | devuelve la cadena: | ||
+ | |||
+ | red, blue and white | ||
+ | |||
+ | ==== Métodos auxiliares ==== | ||
+ | <code java > | ||
+ | public static String cap(String st) | ||
+ | </ | ||
+ | |||
+ | Pone en mayúsculas la primera letra de una cadena de caracteres '' | ||
+ | |||
+ | <code java> | ||
+ | public static String[] union(String[] att1, String[] att2) | ||
+ | public static String[] intersection(String[] att1, String[] att2) | ||
+ | public static String[] remove(String[] att1, String[] att2) | ||
+ | public static String[] remove(String[] att1, String att2) | ||
+ | </ | ||
+ | |||
+ | Implementan operaciones de conjuntos con arrays de caracteres. Están pensadas para manejar conjuntos de atributos. El método '' | ||
+ | |||
+ | |||
+ | <code java> | ||
+ | public static URL getURL(String sURL) | ||
+ | </ | ||
+ | |||
+ | Devuelve la URL del archivo, para ello sustituye la cadena que se le pasa como argumento '' | ||
es/manual/items/generativos/siette.util.corpus.dictionary.1621966781.txt.gz · Última modificación: 2021/05/25 18:19 por root