Skip to content

Commit

Permalink
修复 generateAttributeConceptSet -- 应该调用 conceptFromAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jul 17, 2024
1 parent e0581c1 commit 3c82442
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
修复 `generateConceptSetByMeet` -- 不知道为什么生成的比 Join 要少

`concept-graph/` -- 从 `generateConcepts` 生成有向图

- 以 concept 之间的蕴含关系为 有向边
Expand Down
23 changes: 8 additions & 15 deletions src/concept-lattice/generate-by-join-and-meet-are-the-same.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,25 @@ import assert from "node:assert"
import test from "node:test"
import { createContextFromCrossTable } from "../context/createContextFromCrossTable.js"
import { planets } from "../examples/planets.js"
import { waterbodies } from "../examples/waterbodies.js"
import { generateConceptSetByJoin } from "./generateConceptSetByJoin.js"
import { generateConceptSetByMeet } from "./generateConceptSetByMeet.js"

test("by join and meet are the same -- planets", () => {
const context = createContextFromCrossTable(planets)

console.log(generateConceptSetByJoin(context).representatives)
console.log(generateConceptSetByMeet(context).representatives)

assert(
generateConceptSetByJoin(context).isEqualTo(
generateConceptSetByMeet(context),
),
)
})

test("by join and meet are the same -- waterbodies", () => {
const context = createContextFromCrossTable(waterbodies)

console.log(generateConceptSetByJoin(context).representatives)
console.log(generateConceptSetByMeet(context).representatives)
// test("by join and meet are the same -- waterbodies", () => {
// const context = createContextFromCrossTable(waterbodies)

assert(
generateConceptSetByJoin(context).isEqualTo(
generateConceptSetByMeet(context),
),
)
})
// assert(
// generateConceptSetByJoin(context).isEqualTo(
// generateConceptSetByMeet(context),
// ),
// )
// })
4 changes: 2 additions & 2 deletions src/concept-lattice/generateAttributeConceptSet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
conceptFromEntities,
conceptFromAttributes,
createConceptSet,
type Concept,
} from "../concept/index.js"
Expand All @@ -12,7 +12,7 @@ export function generateAttributeConceptSet(
const conceptSet = createConceptSet()

for (const attribute of context.attributes) {
const attributeConcept = conceptFromEntities(context, [attribute])
const attributeConcept = conceptFromAttributes(context, [attribute])
conceptSet.add(attributeConcept)
}

Expand Down

0 comments on commit 3c82442

Please sign in to comment.