Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@osma
Copy link
Member

@osma osma commented Aug 7, 2025

3rd part of #813, after #864.

This PR adds a new --metadata / -D option to the annif suggest CLI command. It allows specifying metadata to go along with a document that is read from stdin. This is useful when testing projects that have a select() transform that operates on custom metadata fields.

Example use

For example, if myproject has a setting transform=select(title,description,text), then it can be tested appropriately with this command:

annif suggest myproject -D "title=As We May Think" -D "description=A visionary essay" <essay.txt

Without the -D option, only the text would be read from stdin, but the metadata fields would remain unset during the suggest operation.

Limitations

This applies only to the case where annif suggest is used on a single document read from stdin (with or without - as the path parameter). If annif suggest is used with a path to a corpus of documents (a directory of .txt files), then likely every document would have its own metadata values anyway, and an option for setting metadata values once for the full set would not be very useful.

@osma osma self-assigned this Aug 7, 2025
@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.66%. Comparing base (cc993f5) to head (595fc06).
⚠️ Report is 112 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #866   +/-   ##
=======================================
  Coverage   99.65%   99.66%           
=======================================
  Files         102      102           
  Lines        7629     7649   +20     
=======================================
+ Hits         7603     7623   +20     
  Misses         26       26           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@osma osma changed the title WIP: CLI suggest option for additional metadata Flexible fusion part 3: CLI suggest option for additional metadata Aug 7, 2025
@osma osma added this to the 1.4 milestone Aug 7, 2025
@osma osma marked this pull request as ready for review August 7, 2025 09:04
@osma
Copy link
Member Author

osma commented Aug 7, 2025

Ping @c-poley @RietdorfC, you may be interested in testing this.

@osma osma requested a review from juhoinkinen August 7, 2025 09:06
@c-poley
Copy link

c-poley commented Aug 7, 2025

Ping @c-poley @RietdorfC, you may be interested in testing this.

Yes, we are very interested in. Meanwhile, Clemens and Sandro startet to test the new functionalities. 👍

Copy link
Member

@juhoinkinen juhoinkinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this quickly, works and looks good!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 7, 2025

@osma osma merged commit 391e50f into main Aug 7, 2025
14 checks passed
@osma osma deleted the issue813-flexible-fusion-cli-suggest-metadata branch August 7, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants