Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions factlog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ def cmd_doctor(_args: argparse.Namespace) -> int:
#
# Type meanings:
# date 2030.1 / 2030-01-15 -> sortable yyyymmdd
# number 1,000 / 3.5 -> numeric magnitude (declared only; not yet
# engine-projectable — see issue #125)
# number 1,000 / 3.5 -> fixed-point int64, scaled ×1000 (3 decimals,
# positive only); thresholds in scaled units
# (e.g. `V >= 2.0` -> `V >= 2000`)
# ordinal rank 3 / 3rd -> int rank
# amount 100억 / 1,000원 -> integer base unit (needs a unit table)
#
Expand Down
31 changes: 27 additions & 4 deletions skills/factlog/references/text-to-fact.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,33 @@ subject,relation,object,source,status,confidence,note

각 행은 검증 가능한 관계 명제 하나만 담습니다.

타입 지정 리터럴 객체는 구조가 더 분명하면 compact compound term으로 적을 수
있습니다. 지원 형식은 `date(2030,1)`, `date(2030,1,15)`, `number(2.5)`,
`ordinal(3)`, `amount(100,"억")`입니다. 엔티티 객체는 compound term으로 감싸지
말고 평범한 이름으로 둡니다.
### 타입 지정 리터럴은 컴파운드 텀으로 (재량 아님)

객체가 **날짜·금액·순위·일반 수치**처럼 타입이 있는 리터럴이면, 프로즈 문자열로
두지 말고 **반드시 compact compound term으로** 적습니다. 프로즈로 두면(예:
`"2017.03.08"`, `"126백만원"`, `"3등"`) 엔진이 정렬·임계값·범위 비교에 쓸 수
없고, 단위·구조가 모호해집니다. 컴파운드 텀은 값의 구조를 보존해 두므로, 나중에
`typed-relations.md` 선언만 켜면 **재추출 없이** 비교가 바로 붙습니다.

| 타입 | 형식 | 예시 |
|----|----|----|
| 날짜 | `date(연)` · `date(연,월)` · `date(연,월,일)` | `2017.03.08` → `date(2017,3,8)` |
| 순위 | `ordinal(n)` | `3등` → `ordinal(3)` |
| 금액 | `amount(수, "단위")` | `100억` → `amount(100,"억")` |
| 일반 수치 | `number(n)` | `2.5` → `number(2.5)` |

**엔진 지원 현황(과대약속 금지).** `date`·`ordinal`·`number`·`amount` 모두 비교
가능한 스칼라(int64)로 투영됩니다. `number`는 ×1000 고정소수점으로 저장되므로
(소수 3자리), 비교 임계값은 **스케일 정수**로 씁니다 — `V >= 2.0`이 아니라
`V >= 2000` (엔진의 `.dl` 텍스트 파서가 float 임계값을 거부하며, 가드가 명확한
메시지로 잡아줌). 단, `number`·`amount`는 **음수를 받지 않으므로**(둘 다 양수만
파싱), 음수가 될 수 있는 값(예: 적자 영업이익)은 비교 대상으로 만들 수 없고
평범한 문자열로 두어 일치 질의로만 다룹니다. `amount`는 추가로 단위표가 필요합니다.

엔티티 객체(기관명·사람·기술명 등)는 compound term으로 감싸지 말고 평범한
이름으로 둡니다. 또한 비교 대상이 될 리터럴 관계는 `policy/attribute-relations.md`
(리터럴 선언)와, 비교가 필요하면 `policy/typed-relations.md`(타입+별칭)에도 함께
등록해야 실제로 투영·비교됩니다.

`confidence`는 source 문서가 해당 subject-relation-object 관계를 얼마나 직접 뒷받침하는지 나타내는 0.00부터 1.00 사이의 점수입니다.
명시적으로 쓰여 있으면 높게, 관계명 선택이나 동일 개념 판단이 필요하면 낮게 둡니다.
Expand Down