<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>MIURA</title>
  <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
</head>
<body>
<div class="container">

{% if error %}
<div class="alert alert-warning" role="alert">
  <a href="#" class="alert-link">{{error}}</a>
  <pre>{{trace}}</pre>
</div>
{% end %}

  <h1>MIURA: Morpheme I U Regexp A</h1>
  <form method="get" action="/find" class="form-inline">
    <div class="row">
    <div class="form-group col-xs-8">
      <label class="sr-only">Pattern</label>
      <input type="text" class="form-control" id="detect-name" name="pat" value="{{pat}}">
    </div>
    <input type="submit" class="btn btn-default" value="Find">
    </div>
    <small>
      ex: 
      <a href="/find?pat=<pos%3d名詞>">名詞</a>,
      <a href="/find?pat=<pos%3d名詞><pos%3d助詞>">名詞-助詞</a>,
      <a href="/find?pat=<pos%3d名詞>*">名詞*</a>,
      <a href="/find?pat=<pos%3d名詞>*<pos%3d助詞><pos%3d名詞>*">名詞*-助詞-名詞*</a>,
      <a href="/find?pat=(<pos%3d名詞>|<pos%3d助詞>)*">(名詞|助詞)*</a>,
      <a href="/find?pat=<pos%3d感動詞>">感動詞</a>
    </small>
  </form>


{% if results %}

{% if len(results) == 0 %} 

No result

{% else %}
{% for i, res in enumerate(results) %}
<h3>{{i + 1}}: {{res['original']}}</h3>

<ul>
{% for r in res['result'] %}
<li>
{% for morph in r['match'] %}
{{morph['surface']}}
{% end %}
</li>
{% end %}
</ul>

{% end %}
{% end %}
{% end %}

</div>
</body>
</html>
