Annif vocab_id

56 views
Skip to first unread message

Wided MEFLAH

unread,
Feb 5, 2024, 1:59:29 AMFeb 5
to Annif Users
Hi, 
I just ran the hyperopt command on Annif but found it to be missing. I upgraded Annif to another version and found that the hyperopt command exists in this latest version. However, when I tried to reload the vocabulary I created, I noticed that a different command is required this time, one that requires the vocabulary ID instead of the project. I created the vocabulary myself and saved it in acsv  file, but I'm having difficulty determining its ID for the command. Does anyone have any ideas? 
Thanks.

Osma Suominen

unread,
Feb 6, 2024, 3:26:49 AMFeb 6
to annif...@googlegroups.com
Hi Wided,

the vocabulary ID is simply the name you gave the vocabulary in the
configuration file. For example if you have this in projects.cfg:

vocab=myvocab

then the vocabulary ID is "myvocab" and it can be loaded like this:

annif load-vocab myvocab file.ttl

(also other formats can be used e.g. tsv, csv, rdf...)

The load-vocab command appeared in Annif 0.59 and the old loadvoc
command was removed in Annif 0.60. This change was done to improve the
support for multilingual vocabularies. You can find out more in the
release notes for Annif 0.59:
https://github.com/NatLibFi/Annif/releases/tag/v0.59.0

Hope this helps!

-Osma
> --
> You received this message because you are subscribed to the Google
> Groups "Annif Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to annif-users...@googlegroups.com
> <mailto:annif-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/annif-users/ee3ffddf-846b-420f-a06a-7f89f0d4fe4cn%40googlegroups.com <https://groups.google.com/d/msgid/annif-users/ee3ffddf-846b-420f-a06a-7f89f0d4fe4cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 15 (Unioninkatu 36)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.s...@helsinki.fi
http://www.nationallibrary.fi

Wided MEFLAH

unread,
Feb 6, 2024, 5:49:46 AMFeb 6
to Annif Users
I appreciate your assistance. However, I encountered an issue while attempting to load the vocabulary with version 1.0.2 of Annif. The error message I received is uri=annif.util.cleanup_uri(row["uri"]), KeyError: 'uri'. 
The vocabulary format is structured as follows: 

uri label_fr 

Do you have any suggestions on how to resolve this problem? Thank you

Osma Suominen

unread,
Feb 7, 2024, 10:22:19 AMFeb 7
to annif...@googlegroups.com
Hello,

is this a .csv or a .tsv file? What command did you use?

The subject vocabulary formats are documented here:
https://github.com/NatLibFi/Annif/wiki/Subject-vocabulary-formats

Note that in the TSV format the columns are fixed without any column
header, while in the CSV format there is an additional header line that
specifies the meaning of each column. It seems to me that you've created
a TSV file, but you've included a header line. You should either remove
the header line or use the CSV format (i.e. commas instead of tabs
between columns).

Best,
Osma
> https://groups.google.com/d/msgid/annif-users/ee3ffddf-846b-420f-a06a-7f89f0d4fe4cn%40googlegroups.com <https://groups.google.com/d/msgid/annif-users/ee3ffddf-846b-420f-a06a-7f89f0d4fe4cn%40googlegroups.com> <https://groups.google.com/d/msgid/annif-users/ee3ffddf-846b-420f-a06a-7f89f0d4fe4cn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/annif-users/ee3ffddf-846b-420f-a06a-7f89f0d4fe4cn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> Osma Suominen
> D.Sc. (Tech), Information Systems Specialist
> National Library of Finland
> P.O. Box 15 (Unioninkatu 36)
> 00014 HELSINGIN YLIOPISTO
> Tel. +358 50 3199529 <tel:+358%2050%203199529>
> osma.s...@helsinki.fi
> http://www.nationallibrary.fi <http://www.nationallibrary.fi>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Annif Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to annif-users...@googlegroups.com
> <mailto:annif-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/annif-users/c3c2af11-53d5-4081-9e4c-a5a8c461da33n%40googlegroups.com <https://groups.google.com/d/msgid/annif-users/c3c2af11-53d5-4081-9e4c-a5a8c461da33n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages