Example #1
0
    :synopsis: This module shows example usage
"""

import fix_path
import os
import webbrowser
from similarity import WebPage
from utils import (
    TemplateData,
    create_result_as_html,
)


if __name__ == '__main__':
    w1 = WebPage(
        url="http://automotive.about.com/b/2012/06/14/how-to-become-a-new-car-dealer.htm"
    )
    w2 = WebPage(
        url="http://ipod.about.com/od/KidsiPhoneiPodTouch/tp/Roadtrips-With-Iphone-And-Apps.htm"
    )

    text_similarity = w1.get_text_similarity(w2)

    image_similarity = w1.get_image_similatiry(w2)

    template_data = TemplateData(
        template_path="template.html",
        first_web_page=w1,
        second_web_page=w2,
        text_similarity=text_similarity,
        image_similarity=image_similarity,
#!/usr/bin/env python
"""
.. module:: main
    :synopsis: This module shows example usage
"""
import fix_path
from similarity import WebPage
from utils import print_sorted_dict
from os import path


if __name__ == '__main__':
    w1 = WebPage(
        url="http://automotive.about.com/b/2012/06/14/how-to-become-a-new-car-dealer.htm"
    )
    w2 = WebPage(
        url="http://ipod.about.com/od/KidsiPhoneiPodTouch/tp/Roadtrips-With-Iphone-And-Apps.htm"
    )

    print "Text Similarity for w1 and w2"
    comparsion = w1.get_text_similarity(w2)

    print "Result: ", comparsion.similarity_result
    print "Important categories:"
    for cat in comparsion.important_categories:
        print cat

    print_sorted_dict(w1.content.categories_membership, "car")
    print_sorted_dict(w2.content.categories_membership, "ipod")

    print("\nMany images:")