| Akron | 9dcb4f2 | 2017-07-04 12:32:13 +0200 | [diff] [blame] | 1 | package Krawfish::Koral::Corpus::Static; |
| Akron | acde0ba | 2017-12-08 14:05:13 +0100 | [diff] [blame] | 2 | use Role::Tiny::With; |
| Akron | 9dcb4f2 | 2017-07-04 12:32:13 +0200 | [diff] [blame] | 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| Akron | acde0ba | 2017-12-08 14:05:13 +0100 | [diff] [blame] | 6 | with 'Krawfish::Koral::Corpus'; |
| 7 | |
| Akron | 9dcb4f2 | 2017-07-04 12:32:13 +0200 | [diff] [blame] | 8 | # Accepts an identifier to a static virtual corpus query |
| 9 | # (e.g. a list of text/Siglen), represented as a normalized |
| 10 | # KoralQuery file on disc. |
| 11 | |
| 12 | sub new { |
| 13 | my $class = shift; |
| 14 | bless { |
| 15 | id => shift |
| 16 | }, $class; |
| 17 | }; |
| 18 | |
| 19 | # Do nothing |
| 20 | sub normalize { |
| 21 | $_[0]; |
| 22 | }; |
| 23 | |
| 24 | # Check if the ID is cached. In case it is cached, |
| 25 | # Return the cache query. |
| Akron | 290f59f | 2017-08-17 21:55:07 +0200 | [diff] [blame] | 26 | sub memoize { |
| 27 | ... |
| 28 | }; |
| Akron | 9dcb4f2 | 2017-07-04 12:32:13 +0200 | [diff] [blame] | 29 | |
| 30 | # Load the KoralQuery file, optimize the query, |
| 31 | # and wrap it in a cache for the next type it is consulted. |
| 32 | # The query is already normalized. |
| 33 | # This should only be loaded by some segments with updates. |
| Akron | 290f59f | 2017-08-17 21:55:07 +0200 | [diff] [blame] | 34 | sub optimize { |
| 35 | ... |
| 36 | }; |
| Akron | 9dcb4f2 | 2017-07-04 12:32:13 +0200 | [diff] [blame] | 37 | |
| 38 | |
| Akron | 290f59f | 2017-08-17 21:55:07 +0200 | [diff] [blame] | 39 | sub operands { |
| 40 | ... |
| 41 | }; |
| Akron | 4f9eef4 | 2017-07-24 11:41:09 +0200 | [diff] [blame] | 42 | |
| Akron | 9dcb4f2 | 2017-07-04 12:32:13 +0200 | [diff] [blame] | 43 | 1; |