Statistique des contenu d'un texte

alexbenjo Messages postés 7 Date d'inscription samedi 7 mai 2005 Statut Membre Dernière intervention 25 mai 2007 - 6 avril 2007 à 15:35
Ombitious_Developper Messages postés 2333 Date d'inscription samedi 28 février 2004 Statut Membre Dernière intervention 26 juillet 2013 - 25 mai 2007 à 21:46
bonjour,
enfaite je suis un étudiant en derniére année en informatique,et dans le cadre de mon projet de fin d'étude je travaille sur les données textuelles,et je voulai savoir si quelqu'un a u  programe de statistique qui pourai m'aidé a exploité ls contenu de texte par exemple m'aitre le nobre d'apparition de chaque mot dans un draphe statistique(ex: graphe des écart)!
merci.

5 réponses

Ombitious_Developper Messages postés 2333 Date d'inscription samedi 28 février 2004 Statut Membre Dernière intervention 26 juillet 2013 38
6 avril 2007 à 15:44
Salut:

Trouver un code tout fait n'est toujours garantit !!!



________________________________________________________________________________
A.B. : 
"Dieu nous donne des mains, mais il ne bâtit pas les ponts"
0
Anthed Messages postés 152 Date d'inscription dimanche 20 février 2005 Statut Membre Dernière intervention 17 janvier 2014 3
10 avril 2007 à 16:57
Hello,

Une petite indication pour démarrer : un StringTokenizer pour récupérer la liste des différents mots, une Hashtable pour les ranger (les mots en guise de clé et un compteur pour objet correpondant), éventuellement une List et un Comparator pour les classer et enfin, jfreechart pour le graphique.

Tchô.
0
alexbenjo Messages postés 7 Date d'inscription samedi 7 mai 2005 Statut Membre Dernière intervention 25 mai 2007
25 mai 2007 à 13:13
bonjour,
a ce que vous pouvez m'aidé et me donné une solution comme arriére-plan sur un JFrame ou bien sur un JPanel??
parceque juqu'au la je peu pa m'aitre des label sur une image que j'importe et ke je cole sur un JPanel??
merci. 
0
Ombitious_Developper Messages postés 2333 Date d'inscription samedi 28 février 2004 Statut Membre Dernière intervention 26 juillet 2013 38
25 mai 2007 à 21:44
Salut:

Tu as de la chance j'ai sous moi deux codes pour faire ça:

Code1:

import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
 
public class BackgroundImage extends JFrame
{
    JScrollPane scrollPane;
    ImageIcon icon;
    Image image;
 
    public BackgroundImage()
    {
        icon = new ImageIcon("???.jpg");
 
        JPanel panel = new JPanel()
        {
            protected void paintComponent(Graphics g)
            {
                //  Dispaly image at at full size
                g.drawImage(icon.getImage(), 0, 0, null);
 
                //  Scale image to size of component
//                Dimension d = getSize();
//                g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
 
                //  Fix the image position in the scroll pane
//                Point p = scrollPane.getViewport().getViewPosition();
//                g.drawImage(icon.getImage(), p.x, p.y, null);
 
                super.paintComponent(g);
            }
        };
        panel.setOpaque( false );
        panel.setPreferredSize( new Dimension(400, 400) );
        scrollPane = new JScrollPane( panel );
        getContentPane().add( scrollPane );
 
        JButton button = new JButton( "Hello" );
        panel.add( button );
    }
 
    public static void main(String [] args)
    {
        BackgroundImage frame = new BackgroundImage();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 300);
        frame.setLocationRelativeTo( null );
        frame.setVisible(true);
    }
}
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Ombitious_Developper Messages postés 2333 Date d'inscription samedi 28 février 2004 Statut Membre Dernière intervention 26 juillet 2013 38
25 mai 2007 à 21:46
Salut:

Code 2:

import java.awt.*;
import java.awt.image.*;
import javax.swing.*;

public class ImagePanel extends JPanel
{
    public static final int TILED = 0;
    public static final int SCALED = 1;
    public static final int ACTUAL = 2;

    private BufferedImage image;
    private int style;
    private float alignmentX = 0.5f;
    private float alignmentY = 0.5f;

    public ImagePanel(BufferedImage image)
    {
        this(image, TILED);
    }

    public ImagePanel(BufferedImage image, int style)
    {
        this.image = image;
        this.style = style;
        setLayout( new BorderLayout() );
    }

    public void setImageAlignmentX(float alignmentX)
    {
        this.alignmentX = alignmentX > 1.0f ? 1.0f : alignmentX < 0.0f ? 0.0f : alignmentX;
    }

    public void setImageAlignmentY(float alignmentY)
    {
        this.alignmentY = alignmentY > 1.0f ? 1.0f : alignmentY < 0.0f ? 0.0f : alignmentY;

    }

    public void add(JComponent component)
    {
        add(component, null);
    }

    public void add(JComponent component, Object constraints)
    {
        component.setOpaque( false );

        if (component instanceof JScrollPane)
        {
            JScrollPane scrollPane = (JScrollPane)component;
            JViewport viewport = scrollPane.getViewport();
            viewport.setOpaque( false );
            Component c = viewport.getView();

            if (c instanceof JComponent)
            {
                ((JComponent)c).setOpaque( false );
            }
        }

        super.add(component, constraints);
    }

    protected void paintComponent(Graphics g)
    {
        super.paintComponent(g);

        if (image == null ) return;

        switch (style)
        {
            case TILED  :
                drawTiled(g);
                break;

            case SCALED :
                Dimension d = getSize();
                g.drawImage(image, 0, 0, d.width, d.height, null);
                break;

            case ACTUAL :
                drawActual(g);
                break;
        }
    }

    private void drawTiled(Graphics g)
    {
           Dimension d = getSize();
           int width = image.getWidth( null );
           int height = image.getHeight( null );

           for (int x = 0; x < d.width; x += width)
           {
               for (int y = 0; y < d.height; y += height)
               {
                   g.drawImage( image, x, y, null, null );
               }
           }
    }

    private void drawActual(Graphics g)
    {
        Dimension d = getSize();
        float x = (d.width - image.getWidth()) * alignmentX;
        float y = (d.height - image.getHeight()) * alignmentY;
        g.drawImage(image, (int)x, (int)y, this);
    }

    public static void main(String [] args)
        throws Exception
    {
        BufferedImage image = javax.imageio.ImageIO.read( new java.io.File("copy16.gif") );
//      BufferedImage image = javax.imageio.ImageIO.read( new java.io.File("mong.jpg") );

//
//        ImagePanel north = new ImagePanel(image, ImagePanel.TILED);
        ImagePanel north = new ImagePanel(image, ImagePanel.ACTUAL);
        north.setImageAlignmentY(1.0f);
        JTextArea text = new JTextArea(5, 40);
        JScrollPane scrollPane = new JScrollPane( text );
        north.add( scrollPane );
//
        ImagePanel south = new ImagePanel(image, ImagePanel.SCALED);
        JPanel buttons = new JPanel();
        buttons.add( new JButton("One") );
        buttons.add( new JButton("Two") );
        JPanel boxes = new JPanel();
        boxes.add( new JCheckBox("One") );
        boxes.add( new JCheckBox("Two") );
        south.add(buttons, BorderLayout.NORTH);
        south.add(boxes, BorderLayout.SOUTH);
//
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add( north, BorderLayout.NORTH );
        frame.getContentPane().add( south, BorderLayout.SOUTH );
        frame.pack();
        frame.setVisible(true);
    }
}
0
Rejoignez-nous