Menu

2014-02-05  Edit

Frédéric Glorieux
There is a newer version of this page. You can find it here.

Quelques mécanismes objet

TP, implémenter une liste de fréquence lexicale (mots en ordre de fréquence dans un texte), avec une seule classe Motfreq, et uniquement des tableaux.

static

tokenizer

static public void lit(String text) {
    char c;
    int max=text.length();
    StringBuffer sb=new StringBuffer();
    for(int i=0; i <  max; i++) {
        c=text.charAt(i);
        // au milieu d’un mot, ajouter une lettre
        if (Character.isLetter(c)) sb.append(c);
        // pas un caractère, lettres rencontrées, fin de mot, ajouter à la liste
        else if (sb.length() > 0) {
            Mot.add(sb.toString());
            sb.setLength(0);
        }
    }
}

Related

Wiki: Home

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.