Names of unicode characters

19 views
Skip to first unread message

Hans Nowak

unread,
Mar 9, 2016, 9:58:46 PM3/9/16
to SWI-Prolog
Hi,

I was wondering, is there a way in SWI-Prolog to refer to Unicode characters by name? For example, in Python I can do this:

In [4]: s = "\N{BLACK SPADE SUIT}"

In [5]: s
Out[5]: '♠'

In [7]: unicodedata.name(s)
Out[7]: 'BLACK SPADE SUIT'



Is there a similar way to do this in SWI-Prolog? I looked at the unicode library, but it doesn't seem to contain this functionality.


Thanks,


--

Hans Nowak


Paulo Moura

unread,
Mar 10, 2016, 4:04:02 AM3/10/16
to Hans Nowak, SWI-Prolog
Check the VivoMind Prolog Unicode Resources at:

https://github.com/VivoMind/unicode_data

It includes tables of Prolog facts for Unicode code points and their names.

Cheers,

Paulo

-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:pmo...@logtalk.org>
Web: <http://logtalk.org/>
-----------------------------------------------------------------




Hans Nowak

unread,
Mar 10, 2016, 11:36:15 AM3/10/16
to SWI-Prolog, zephyr...@gmail.com


On Thursday, March 10, 2016 at 4:04:02 AM UTC-5, Paulo Moura wrote:

Check the VivoMind Prolog Unicode Resources at:

https://github.com/VivoMind/unicode_data

It includes tables of Prolog facts for Unicode code points and their names.

Thanks!

--
Hans Nowak

Jan Wielemaker

unread,
Mar 11, 2016, 3:06:42 AM3/11/16
to Hans Nowak, SWI-Prolog
In addition, there is library(unicode/unicode_data). See comment at the
start how to use it. You must download the unicode data independently.
It isn't really for high performance querying unicode properties. It
is mostly used to generate C programs or Prolog programs for accessing
selected aspects of Unicode.

Cheers --- Jan

>
>
> Thanks!
>
> --
> Hans Nowak
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages