-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# concept | ||
|
||
`conceptJoin` | ||
`conceptMeet` | ||
|
||
# context | ||
|
||
`generateConcepts(context)` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { setEqual } from "../utils/Set.js" | ||
import type { Concept } from "./Concept.js" | ||
|
||
export function conceptEqual(x: Concept, y: Concept): boolean { | ||
if (x.context !== y.context) return false | ||
return setEqual(x.extent, y.extent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { QuotientSet } from "../utils/QuotientSet.js" | ||
import type { Concept } from "./Concept.js" | ||
import { conceptEqual } from "./conceptEqual.js" | ||
|
||
export function createConceptSet(): QuotientSet<Concept> { | ||
return new QuotientSet({ equal: conceptEqual }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import type { Concept } from "../concept/index.js" | ||
import { | ||
conceptFromEntities, | ||
createConceptSet, | ||
type Concept, | ||
} from "../concept/index.js" | ||
import type { Context } from "./index.js" | ||
|
||
export function generateConcepts(context: Context): Array<Concept> { | ||
const targets: Array<Concept> = [] | ||
const results: Array<Concept> = [] | ||
return results | ||
const targets = createConceptSet() | ||
const results = createConceptSet() | ||
for (const entity of context.entities) { | ||
const entityConcept = conceptFromEntities(context, [entity]) | ||
targets.add(entityConcept) | ||
results.add(entityConcept) | ||
} | ||
|
||
return results.representatives | ||
} |