From 155cbcbbac33e25a61d230b894793139cf01be86 Mon Sep 17 00:00:00 2001 From: NSoiffer Date: Wed, 22 Jan 2025 12:56:17 -0800 Subject: [PATCH] Added 'id' to intent rules. Also added `data-fixity`, but this is experimental and likely will change. --- Rules/Intent/calculus.yaml | 5 +++++ Rules/Intent/geometry.yaml | 3 +++ Rules/Intent/linear-algebra.yaml | 17 ++++++++++++++--- Rules/Intent/probability.yaml | 2 ++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Rules/Intent/calculus.yaml b/Rules/Intent/calculus.yaml index f6cd6106..e4f2fcbb 100644 --- a/Rules/Intent/calculus.yaml +++ b/Rules/Intent/calculus.yaml @@ -9,6 +9,7 @@ replace: - intent: name: "laplacian" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[2]"] - @@ -20,6 +21,7 @@ replace: - intent: name: "laplacian" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [] - @@ -29,6 +31,7 @@ replace: - intent: xpath-name: "IfThenElse(*[1]/*[2][.='×'] , 'curl', 'divergence')" + attrs: "id='@id' data-fixity='\"infix\"'" children: [x: "*[2]"] - @@ -40,6 +43,7 @@ replace: - intent: name: "gradient" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[2]"] - @@ -50,6 +54,7 @@ replace: - intent: name: "modified-variable" + attrs: "id='@id'" children: - x: "*[1]" - x: "*[2]" diff --git a/Rules/Intent/geometry.yaml b/Rules/Intent/geometry.yaml index 796550f5..11ebf42d 100644 --- a/Rules/Intent/geometry.yaml +++ b/Rules/Intent/geometry.yaml @@ -13,6 +13,7 @@ replace: - intent: name: "line-segment" + attrs: "id='@id' data-fixity='\"prefix\"'" children: - x: "*[1]/*[1]" - x: "*[1]/*[3]" @@ -30,6 +31,7 @@ replace: - intent: name: "ray" + attrs: "id='@id' data-fixity='\"prefix\"'" children: - x: "*[1]/*[1]" - x: "*[1]/*[3]" @@ -47,6 +49,7 @@ replace: - intent: name: "arc" + attrs: "id='@id' data-fixity='\"prefix\"'" children: - x: "*[1]/*[1]" - x: "*[1]/*[3]" diff --git a/Rules/Intent/linear-algebra.yaml b/Rules/Intent/linear-algebra.yaml index 42ecd684..0e9d8b74 100644 --- a/Rules/Intent/linear-algebra.yaml +++ b/Rules/Intent/linear-algebra.yaml @@ -11,6 +11,7 @@ replace: - intent: name: "determinant" + attrs: "id='*[2]/@id' data-fixity='\"table\"'" children: [x: "*[2]"] - @@ -23,7 +24,7 @@ replace: - intent: name: "determinant" - attrs: "id='*[2]/@id'" + attrs: "id='*[2]/@id' data-fixity='\"table\"'" children: [x: "*[2]/*"] - @@ -35,7 +36,7 @@ replace: - intent: name: "matrix" - attrs: "id='*[2]/@id'" + attrs: "id='*[2]/@id' data-fixity='\"table\"'" children: [x: "*[2]/*"] - @@ -46,6 +47,7 @@ replace: - intent: name: "norm" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[2]"] @@ -57,6 +59,7 @@ replace: - intent: name: "subscripted-norm" + attrs: "id='@id' data-fixity='\"norm;subscript\"'" children: - x: "*[1]/*[2]" # grab the contents of the bracketed expr - x: "*[2]" @@ -68,6 +71,7 @@ replace: - intent: name: "magnitude" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[2]"] - @@ -78,7 +82,8 @@ replace: - intent: name: "transpose" - children: [x: "*[1]"] + attrs: "id='@id' data-fixity='\"prefix\"'" + children: [x: "*[1]"] - name: trace @@ -88,6 +93,7 @@ replace: - intent: name: "trace" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[3]"] - @@ -98,6 +104,7 @@ replace: - intent: name: "dimension" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[3]"] - @@ -108,6 +115,7 @@ replace: - intent: name: "homomorphism" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[3]"] - @@ -118,6 +126,7 @@ replace: - intent: name: "kernel" + attrs: "id='@id' data-fixity='\"prefix\"'" children: [x: "*[3]"] - @@ -138,6 +147,7 @@ replace: - intent: name: "dot-product" + attrs: "id='@id'" children: [] - @@ -155,4 +165,5 @@ replace: - intent: name: "cross-product" + attrs: "id='@id'" children: [] diff --git a/Rules/Intent/probability.yaml b/Rules/Intent/probability.yaml index 672804b3..30516db9 100644 --- a/Rules/Intent/probability.yaml +++ b/Rules/Intent/probability.yaml @@ -6,6 +6,7 @@ replace: - intent: name: "probability" + attrs: "id='@id'" children: [x: "text()"] - @@ -15,4 +16,5 @@ replace: - intent: name: "given" + attrs: "id='@id'" children: [x: "text()"]