World's first open-source enterprise world model.
Rust agent-memorybitemporalgraphragknowledge-baseknowledge-graphllmontologypgvectorpostgresqlragrustself-hostedsemantic-searchtemporal-knowledge-graphworld-model
A statement says its mood (#745)
WaylandYang1c9e9b5f8d7f
diff --git a/crates/utopia-extract/src/open.rs b/crates/utopia-extract/src/open.rsindex f2b140cf..d1ead1d8 100644--- a/crates/utopia-extract/src/open.rs+++ b/crates/utopia-extract/src/open.rs@@ -164,7 +164,11 @@ to Brightway Builders for $2 million\" gives city council —awarded→ paving cof Hillside School\" gives Jane Doe —is headmaster of→ Hillside School with {\"title\": \\"interim headmaster\"}. A statement with a value takes qualifiers the same way: \"the plant \cut water use by 12% compared to 2019\" gives the plant \"cut water use\" = \"12%\" with \-{\"compared to\": \"2019\"}. qualifiers is null when there are none.\n\+{\"compared to\": \"2019\"}. A statement the passage does not assert as holding but requires, \+plans, expects, forecasts or makes conditional carries a qualifier keyed \"mood\" whose value \+is the passage's own words for that (\"要\", \"should\", \"will\", \"is expected to\", \"if the \+merger closes\"); the phrase stays as written. A verb that reports (announced, said, revealed) \+is not a mood: what was announced is stated. qualifiers is null when there are none.\n\4. When a description has another thing folded into it, also write the statement that unfolds \it: \"hospitals accredited by the Joint Commission\" also gives Joint Commission —accredited→ \hospitals. Do not unfold a description that only names what it belongs to or is about: \"the \diff --git a/crates/utopia-server/src/extraction_open.rs b/crates/utopia-server/src/extraction_open.rsindex 59dabb46..932a8ea0 100644--- a/crates/utopia-server/src/extraction_open.rs+++ b/crates/utopia-server/src/extraction_open.rs@@ -68,8 +68,20 @@ fn locate_time(chunk: &str, quote: Option<(&str, Option<(i32, i32)>)>, words: &s};}// 表格的一行:期数写在表头行里,不在这一行里;这一块就是这张表(分块器让表头- // 跟着每一块走),所以在整块里找。判据是结构的:引文是一行 `|` 开头的表格行- if q.trim_start().starts_with('|') {+ // 跟着每一块走),所以在整块里找。判据是结构的:引文落在块里一行 `|` 开头的+ // 表格行上(模型常把行首的 `| ` 抄掉,所以看块里那一行,不只看引文自己)+ let on_table_row = match span {+ Some((start, _)) => {+ let start = chunk+ .char_indices()+ .nth(start.max(0) as usize)+ .map_or(chunk.len(), |(b, _)| b);+ let line_start = chunk[..start].rfind('\n').map_or(0, |i| i + 1);+ chunk[line_start..].trim_start().starts_with('|')+ }+ None => q.trim_start().starts_with('|') || q.contains(" | "),+ };+ if on_table_row {return locate(chunk, words).map(|(s, _)| s);}None@@ -772,6 +784,9 @@ mod tests {let row = ("| Revenue | $96,221 | $81,615 |", Some((46, 76)));// 期数在表头行里,不在这一行里:表格行在整块里找assert_eq!(locate_time(text, Some(row), "Q2 FY27"), Some(5));+ // 模型把行首的 "| " 抄掉了:引文定位到的那一行还是表格行+ let bare = ("Revenue | $96,221 | $81,615 |", Some((48, 76)));+ assert_eq!(locate_time(text, Some(bare), "Q1 FY27"), Some(15));// 不是表格行的引文还是只认自己那句assert_eq!(locate_time(text, Some(("Revenue was up.", None)), "Q2 FY27"),