on the Curl Web Content Markup Language

on the Curl Web Content Markup and Programming Language from www.curl.com and www.curlap.com
Showing posts with label UCS. Show all posts
Showing posts with label UCS. Show all posts

Saturday, October 13, 2012

Tuesday, May 29, 2012

Japanese Punctuation in UNICODE


Over at http://www.aule-browser.com/kanji/kana-charts-curl.html there is now  a view of all Japanese punctuation listed at ja.wikipedia.org with UNICODE 16-bit and often also the utf-8 for urlencode.

Unfortunately, my favourite HanaMinA font was not adequate to the task, but neither were any of the default Unicode DejaVu, Lucida or Arial fonts.

Here is a snap of the result:


The font-family selection for punctuation characters required the use of a CharClass - a char-map class in Curl.  A total of 4 font families contributed to forming a complete list - most often with half-width presentation preserved.




Monday, May 28, 2012

Curl data versus JSON data (light-weight markup)

Here is the top of a validated JSON katakana data file for Japanese e-learning:

{"katakana": [
{"ucs": "30AB", "utf-8": "E382AB", "kana": "カ", "info": "katakana letter KA"},
{"ucs": "30AC", "utf-8": "E382AC", "kana": "ガ", "info": "katakana letter GA"},
{"ucs": "30AD", "utf-8": "E382AD", "kana": "キ", "info": "katakana letter KI"},
{"ucs": "30AE", "utf-8": "E382AE", "kana": "ギ", "info": "katakana letter GI"},

and here is the Curl:

{let katakana-array:{Array-of Katakana} = {new {Array-of Katakana},
{Katakana "30AB", "E382AB", "カ", "katakana letter KA"},
{Katakana "30AC", "E382AC", "ガ", "katakana
letter GA"},
{Katakana "30AD", "E382AD", "キ", "katakana
letter KI"},
{Katakana "30AE", "E382AE", "ギ", "katakana
letter GI"},

In Curl, both require field definitions for processing - except that the Curl data requres a minimal class definition and a default constructor declaring all fields as being assigned (simple value class).

Of course both could have been reduced to mere arrays of strings, but then the iteration over the data would use no tags or keys.  The Curl version is tagged, but internally:

{define-value-class public final Katakana
  field private constant ucs-code:String || = "0000"
  field private constant utf8-code:String || = "000000"
  field private constant kana-char:String || = {String '\u5B57'} || "字"
  field private constant kana-name:String || = "Ji"
  {getter public {ucs}:String
    {return self.ucs-code}
  }
  {getter public {utf-8}:String
    {return self.utf8-code}
  }
  {getter public {katakana}:String
    {return self.kana-char}
  }
  {getter public {character}:String
    {return self.kana-name}
  }
  {constructor {default ucs:String, utf:String, kana:String, info:String}
    set self.ucs-code = ucs
    set self.utf8-code = utf
    set self.kana-char = kana
    set self.kana-name = info
  }
 }
{include "./katakana-unicode.scurl"}

The iterator block accesses each instance as, e.g., val.ucs and so forth.

In fairness, the JSON could have been

{"katakana-array": [
{"katakana": ["ucs": "30AB", "utf-8": "E382AB", "kana": "カ", "info": "katakana letter KA"]},

but it further complicated iterating over the data.

In the Curl applet the Curl data is processed dramatically faster, naturally.

The JSON data can be used anywhere, e.g., by Pharo Smalltalk or jQuery in web page widgets.

Note: the UTF-8 can be used to urlencode:  "E382B6" becomes %E3%82%B6 for a URL.

Here is one result using the Curl data: (click to view)

 

The applet is located at www.aule-browser.com/kanji/kana-charts.html



Monday, May 14, 2012

joyo kanji

I have added a Curl applet with the joyo kanji from the 2010 revision (that's 2136 dictionary entries from kanjidic2.)


I discuss the features over at my Curl Community blog. Here's the short account: suppose you are at 919; enter 40 and press ENTER.  Once the generic "water" kanji displays, the RIGHT INNER button beside the thin top right-arrow will let you "jump back up" to this 919 "window" kanji.

If you instead jump forward by entering 1926, you can "jump back" with the left "inner" button which is beside of the skinny LEFT arrow at the top.

Why the "jumps" ? The code was needed to add "red" and "green" buttons to a list on which to base "spaced-repetition".

A desktop version for Mac, linux or windows is about 24-hours away.

The list is just a CSV file, so you could move the applet to your own machine if you have a simple script in Rebol or the like - but it will then be a local browser page.  The desktop version will use no browser and store ts state in client-side persistent data instead of cookies.

Wednesday, April 25, 2012

Kanjidic2 as CSV in HTML and text


To aid a neutral party in assessing approaches to digital dictionaries for Japanese, I have posted an HTML file displaying 10,000+ of the first entries in Kanjidic2 at
  http://kanji.aule-browser.com/kanjidic2-m12.html
I have restricted the dump to the Kanji, the UCS code and a max of 12 of a possible 14 meanings.

There are less than 10,200 due to the fact that in the first 12,155 entries, many had no XML meaning content which was not assigned a language attribute.  Those few thousand may have English translations in markup previously used for foreign languages.

The file can be found as
  http://kanji.aule-browser.com/kanjidic2-m12.csv
with a three line header which you may have to alter for your purposes.

The Kanjidic2 XML file was parsed using the Curl XDM library from curl.com (Nihon-go http://www.curlap.com)

As it stands, the HTML file should be useful for building custom Anki flashcards (themselves stored as SQLite.)   I will be using variant CSV output to construct dictionary software with annotations and spaced-repetition options.  Curl has both CSV and SQLite libraries in addition to the XML libraries.