<commit_before>package com.ui4j.sample;

import java.net.URLEncoder;
import java.util.List;

import com.ui4j.api.browser.BrowserEngine;
import com.ui4j.api.browser.BrowserFactory;
import com.ui4j.api.browser.Page;
import com.ui4j.api.dom.Document;
import com.ui4j.api.dom.Element;

public class GoogleSearch {

    public static void main(String[] args) throws Exception {

        String keyword = "java books";
        String encodedKeyword = URLEncoder.encode(keyword, "utf-8");
        String url = String.format("http://www.google.com/?l#q=%s", encodedKeyword);

        BrowserEngine webkit = BrowserFactory.getWebKit();
        Page page = webkit.navigate(url);
        page.waitUntilDocReady();

        page.show();

        Document document = page.getDocument();

        // list all search results
        List<Element> results = document.queryAll("h3.r a");

        // visit the first result page
        results.get(0).click();

        // wait until page load
        page.waitUntilDocReady();

        // extract title, location, content etc. from result page
        System.out.println(String.format("Title: %s, Location: %s",
                page.getDocument().getTitle(),
                page.getWindow().getLocation()));

        page.close();
        webkit.shutdown();
    }
}<commit_msg>Another way to search Google using Ui4j<commit_after>package com.ui4j.sample;

import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.concurrent.TimeUnit;

import com.ui4j.api.browser.BrowserEngine;
import com.ui4j.api.browser.BrowserFactory;
import com.ui4j.api.browser.Page;
import com.ui4j.api.dom.Document;
import com.ui4j.api.dom.Element;

public class GoogleSearch {

    public static void main(String[] args) throws Exception {
        BrowserEngine webkit = BrowserFactory.getWebKit();
		Page page = webkit.navigate("http://www.google.com");
        page.show();

        Document document = page.getDocument();

        document.query("input[name='q']").setAttribute("value", "java book").focus();

        // Send key press event using java.awt.Robot
        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_ENTER);

        page.waitUntilDocReady(1, TimeUnit.SECONDS);

        // list all search results
        List<Element> results = document.queryAll("h3.r a");

        // visit the first result page
        results.get(0).click();

        // wait until page load
        page.waitUntilDocReady();

        // extract title, location, content etc. from result page
        System.out.println(String.format("Title: %s, Location: %s",
                page.getDocument().getTitle(),
                page.getWindow().getLocation()));

        page.close();
        webkit.shutdown();
    }
}
{'fraction_non_alphanumeric': 0.12888086642599278, 'fraction_numerical': 0.0068592057761732855, 'mean_word_length': 2.739541160593792, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3520397', 'n_tokens_mistral': 830, 'n_tokens_neox': 798, 'n_words': 181}