Skip to content

Commit

Permalink
Rename remaining instances of String to StringLitType.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 462523569
  • Loading branch information
cjqian authored and LIT team committed Jul 22, 2022
1 parent 72edd26 commit 65c5b8a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lit_nlp/client/lib/lit_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function registered(target: any) {
const registryKeys = Object.keys(REGISTRY) as ReadonlyArray<string>;
/**
* The types of all LitTypes in the registry, e.g.
* 'String' | 'TextSegment' ...
* 'StringLitType' | 'TextSegment' ...
*/
export type LitName = typeof registryKeys[number];

Expand Down
8 changes: 4 additions & 4 deletions lit_nlp/client/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import {chunkWords, isLitSubtype} from './utils';
export type D3Selection = d3.Selection<any, any, any, any>;

export type LitClass = 'LitType';
export type LitName = 'type'|'LitType'|'String'|'TextSegment'|'GeneratedText'|
'GeneratedTextCandidates'|'ReferenceTexts'|'URL'|'SearchQuery'|'Tokens'|
'TokenTopKPreds'|'Scalar'|'RegressionScore'|'CategoryLabel'|
'MulticlassPreds'|'SequenceTags'|'SpanLabels'|'EdgeLabels'|
export type LitName = 'type'|'LitType'|'StringLitType'|'TextSegment'|
'GeneratedText'|'GeneratedTextCandidates'|'ReferenceTexts'|'URL'|
'SearchQuery'|'Tokens'|'TokenTopKPreds'|'Scalar'|'RegressionScore'|
'CategoryLabel'|'MulticlassPreds'|'SequenceTags'|'SpanLabels'|'EdgeLabels'|
'MultiSegmentAnnotations'|'Embeddings'|'TokenGradients'|'TokenEmbeddings'|
'AttentionHeads'|'SparseMultilabel'|'FieldMatcher'|'MultiFieldMatcher'|
'Gradients'|'Boolean'|'TokenSalience'|'ImageBytes'|'SparseMultilabelPreds'|
Expand Down
2 changes: 1 addition & 1 deletion lit_nlp/client/modules/datapoint_editor_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class DatapointEditorModule extends LitModule {
const fieldSpec = this.appState.currentDatasetSpec[key];
let calculateStringLength : ((s: string) => number) | ((s: string[]) => number);

if (isLitSubtype(fieldSpec, ['String', 'TextSegment'])) {
if (isLitSubtype(fieldSpec, ['StringLitType', 'TextSegment'])) {
calculateStringLength = (s: string) => s.length;
}
else if (isLitSubtype(fieldSpec, 'SparseMultilabel')) {
Expand Down
5 changes: 3 additions & 2 deletions lit_nlp/client/modules/embeddings_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,9 @@ export class EmbeddingsModule extends LitModule {
}

private getLabelByFields() {
return findSpecKeys(this.appState.currentDatasetSpec,
['TextSegment', 'Scalar', 'String', 'CategoryLabel']);
return findSpecKeys(
this.appState.currentDatasetSpec,
['TextSegment', 'Scalar', 'StringLitType', 'CategoryLabel']);
}

private getImageFields() {
Expand Down

0 comments on commit 65c5b8a

Please sign in to comment.