Skip to content

Commit

Permalink
Replace dictionary-based LitType approximations with real class con…
Browse files Browse the repository at this point in the history
…structors.

PiperOrigin-RevId: 460493686
  • Loading branch information
cjqian authored and LIT team committed Jul 12, 2022
1 parent c020d25 commit eb02465
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 304 deletions.
36 changes: 8 additions & 28 deletions lit_nlp/client/lib/generated_text_utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,28 @@
import 'jasmine';

import {canonicalizeGenerationResults, getAllOutputTexts, getAllReferenceTexts, getFlatTexts, getTextDiff} from './generated_text_utils';
import {createLitType} from './lit_types_utils';
import {Input, LitType, Preds, Spec} from './types';

// TODO(b/162269499): replace with a real class constructor.
function textSegmentType(): LitType {
return {
'__class__': 'LitType',
'__name__': 'TextSegment',
'__mro__': ['TextSegment', 'LitType', 'object'],
return createLitType('TextSegment', {
'required': false,
};
});
}

// TODO(b/162269499): replace with a real class constructor.
function referenceTextsType(): LitType {
return {
'__class__': 'LitType',
'__name__': 'ReferenceTexts',
'__mro__': ['ReferenceTexts', 'LitType', 'object'],
return createLitType('ReferenceTexts', {
'required': false,
};
});
}

// TODO(b/162269499): replace with a real class constructor.
function generatedTextType(parent: string): LitType {
return {
'__class__': 'LitType',
'__name__': 'GeneratedText',
'__mro__': ['GeneratedText', 'TextSegment', 'LitType', 'object'],
'required': false,
parent
};
return createLitType('GeneratedText', {'required': false, 'parent': parent});
}

// TODO(b/162269499): replace with a real class constructor.
function generatedTextCandidatesType(parent: string): LitType {
return {
'__class__': 'LitType',
'__name__': 'GeneratedTextCandidates',
'__mro__': ['GeneratedTextCandidates', 'TextSegment', 'LitType', 'object'],
'required': false,
parent
};
return createLitType(
'GeneratedTextCandidates', {'required': false, 'parent': parent});
}

describe('canonicalizeGenerationResults test', () => {
Expand Down
Loading

0 comments on commit eb02465

Please sign in to comment.