Giter Site home page Giter Site logo

location-autocomplete's Introduction

<html>
<title>Location autocomplete programming exercise README</title>
<style type="text/css">
    body{background-color:#eee;font-family:Arial,sans-serif;padding:20px 0;}
    #content{width:880px;border:2px solid #ccc;background-color:#fff;
        margin:0 auto;padding:15px 30px;box-shadow:0 0 5px #999;}
    h1{font-weight:bold;margin-bottom:25px;font-size:21px;}
    h2{font-weight:bold;margin:25px 0 15px 0;font-size:14px;}
    ul{margin:0 0 10px 50px;}
    li{margin-bottom:5px;}
    p{margin-bottom:10px;}
    pre{margin-bottom:5px;background-color:#CCC;padding:5px;width:850px;margin-left:5px}
    .diagram{display:block;margin:0 auto;}
</style>
</head>
<body id="top">
<div id="content">

<h1>README</h1>

<ul>
    <li><a href="#overview">Overview</a></li>
    <li><a href="#at">Location autocomplete</a></li>
    <li><a href="#wctw">What Code to Write</a></li>
    <li><a href="#bar">Building and Running</a></li>
</ul>

<h2 id="overview">OVERVIEW</h2>

<p>
    Ever since Google introduced Google Suggest several years ago, a "suggest" or
    autocomplete feature has become standard on many search-related websites. As an example, see <a href="images/autocomplete.png">indeed's what autocomplete</a>.
    Your task is to implement part of the "suggest" component for the "where" field
    on indeed.com.
</p>

<h2 id="at">LOCATION AUTOCOMPLETE </h2>
<p>
    We have provided a skeleton java program that currently returns a hard coded list as the list of
    suggestions instead of their completions.  Your job is to implement the functionality in <i>Suggester.java</i>
    to return a better set of suggestions, given
    a user input. To help you build the list of suggestions, we have provided a
    log file containing the actual locations for about 440,000 actual user searches.
    The log file (query.log) contains one line per user search.  Here is an example line from this log file:

<pre>
ip=24.116.26.171&iplat=33.585&iplon=-88.414&l=columbus+ms&match=Columbus%2C+MS&loclat=33.495&loclon=-88.423
</pre>


<p> There's also a sample log file with only 10 log lines, sample_query.log you can use for development/testing.

    <p>
    The format of each line is similar to URL parameters, containing a set of name/value pairs.
    Each name value pair looks like "name=value", and they are separated by ampersand "&".
    In addition, the names and values are URL encoded. The code for parsing the input file is already written (<i>LogReader</i>). There's a call back method in <i>Suggester.java</i> called <i>processEntries</i> that's called on every input line. It provides a map containing these keys and values.
    </p>

    So in the example line above, essentially you have a map with the following entries:

    <p>

    <table border="1" cellpadding="5">
        <tr>
            <th>Name</th>   <th>Value</th>  <th>Meaning</th>
        </tr>
        <tr>
        <td>ip</td><td>24.116.26.171</td><td>The user's IP address</td>
        </tr>
        <tr>
            <td>iplat</td><td>33.585</td><td>The latitude for the user's IP number</td>
        </tr>
        <tr>
            <td>iplon</td><td>-88.414</td><td>The longitude for the user's IP number</td>
        </tr>
        <tr>
            <td>l</td><td>columbus ms</td><td>What the user entered for his or her location</td>
        </tr>
        <tr>
            <td>match</td><td>Columbus, MS</td><td>The actual well-formatted matched location</td>
        </tr>
        <tr>
            <td>loclat</td><td>33.495</td><td>The latitude for the actual matched location</td>
        </tr>
        <tr>
            <td>loclon</td><td>-88.423</td><td>The longitude for the actual matched location</td>
        </tr>

    </table>


    <p>



<p>
You don't necessarily have to use all of the fields provided.


<h2 id="wctw">WHAT CODE TO WRITE </h2>
<p>
You will need to implement the methods <i>processEntries</i> and <i>getTopSuggestions</i>. You can modify the Suggester class as needed, as well as create any other helper classes/data structures.

<p>

As with many problems, there are competing interests to think about.  Here are the priorities,
most important first:
<ol type="1">
<li> The suggestor gives suggestions that are likely to be useful to the user. </li>

<li>  The suggestor is fast and has a reasonable runtime complexity, since it's
     called for every keystroke the user types. </li>

<li>  The suggestor has reasonable runtime memory requirements. The runner script currently sets this to 512MB </li>

<li>  Startup/initialization time - faster is better, but this is less important than runtime speed.</li>

</ol>
Once you're satisified with your implementation, please write up a short
English description of how you solved the problem, and what you would do to further improve your
solution in a text filed named SOLUTION.txt.  Please note that your solution must be completely your own
and you may not use any 3rd party libraries or code that has not already been provided to you by Indeed.


<h2 id="bar">BUIDLING AND RUNNING</h2>
<p>
    To run the Suggestor:
<pre>./autocomplete.sh query.log</pre> It should prompt you to enter a prefix and display a list of suggestions. For testing you may use the smaller input file sample_query.log.
</p>
<p>
Note: autocomplete.sh requires <a href="http://ant.apache.org/">Apache Ant</a> to be installed locally and for it to be in the user's PATH.
</p>

</div>

</body>

</html>

location-autocomplete's People

Contributors

ambroselittle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.