How to use @microsoft/bf-lu - 7 common examples

To help you get started, we’ve selected a few @microsoft/bf-lu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / experimental / adaptive-tool / src / lu / providers / completion.ts View on Github external
private extractLUISContent(text: string): Promise {
    let parsedContent: any;
    const log = false;
    const locale = 'en-us';
    try {
      parsedContent = parseFile(text, log, locale);
    } catch (e) {
      // nothing to do in catch block
    }

    if (parsedContent !== undefined) {
      return Promise.resolve(parsedContent.LUISJsonStructure);
    } else {
      return undefined;
    }
  }
}
github microsoft / BotBuilder-Samples / experimental / adaptive-tool / src / lu / providers / diagnostics.ts View on Github external
function updateDiagnostics(document: vscode.TextDocument, collection: vscode.DiagnosticCollection): void {
  if (!util.isLuFile(document.fileName)) {
    collection.clear();
    return;
  }

  let luResource = LUParser.parse(document.getText());
  
  let diagnostics = luResource.Errors;
  let vscodeDiagnostics: vscode.Diagnostic[] = [];

  const severityConverter = {
    ERROR: 0,
    WARN: 1
  }

  diagnostics.forEach(u => {
    const diagItem = new vscode.Diagnostic(
      new vscode.Range(
        new vscode.Position(u.Range.Start.Line - 1, u.Range.Start.Character),
        new vscode.Position(u.Range.End.Line - 1, u.Range.End.Character)),
      u.Message,
      severityConverter[u.Severity]
github microsoft / BotBuilder-Samples / experimental / generation / generator / packages / library / src / mergeAssets.ts View on Github external
async function changeEntityEnumLU(schemaName: string, oldPath: string, oldFileList: string[], newFileList: string[], mergedPath: string, filename: string, feedback: Feedback): Promise {
    let newFilePath = newFileList.filter(file => file.match(filename))[0]
    let text = await fs.readFile(newFilePath, 'utf8')
    let newLUResource = LUParser.parse(text)
    let newEntitySections = newLUResource.Sections.filter(s => s.SectionType === lusectiontypes.NEWENTITYSECTION)

    let oldFilePath = oldFileList.filter(file => file.match(filename))[0]
    text = await fs.readFile(oldFilePath, 'utf8')
    let oldLUResource = LUParser.parse(text)
    let oldEntitySections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.NEWENTITYSECTION)
    let oldIntentSections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.SIMPLEINTENTSECTION && s.Name === schemaName)

    let oldSectionOp = new sectionOperator(oldLUResource)
    let updatedLUResource: any = null

    let oldListEntitySections = oldEntitySections.filter(s => s.Type === 'list')
    for (let oldListEntitySection of oldListEntitySections) {
        if (!oldListEntitySection.Name.match('Entity')) {
            continue
        }

        for (let newEntitySection of newEntitySections) {
            if (newEntitySection.Name !== oldListEntitySection.Name) {
                continue
            }
github microsoft / BotBuilder-Samples / experimental / generation / generator / packages / library / src / mergeAssets.ts View on Github external
async function changeEntityEnumLU(schemaName: string, oldPath: string, oldFileList: string[], newFileList: string[], mergedPath: string, filename: string, feedback: Feedback): Promise {
    let newFilePath = newFileList.filter(file => file.match(filename))[0]
    let text = await fs.readFile(newFilePath, 'utf8')
    let newLUResource = LUParser.parse(text)
    let newEntitySections = newLUResource.Sections.filter(s => s.SectionType === lusectiontypes.NEWENTITYSECTION)

    let oldFilePath = oldFileList.filter(file => file.match(filename))[0]
    text = await fs.readFile(oldFilePath, 'utf8')
    let oldLUResource = LUParser.parse(text)
    let oldEntitySections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.NEWENTITYSECTION)
    let oldIntentSections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.SIMPLEINTENTSECTION && s.Name === schemaName)

    let oldSectionOp = new sectionOperator(oldLUResource)
    let updatedLUResource: any = null

    let oldListEntitySections = oldEntitySections.filter(s => s.Type === 'list')
    for (let oldListEntitySection of oldListEntitySections) {
        if (!oldListEntitySection.Name.match('Entity')) {
            continue
        }
github microsoft / BotBuilder-Samples / experimental / generation / generator / packages / library / src / mergeAssets.ts View on Github external
    let oldEntitySections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.NEWENTITYSECTION)
    let oldIntentSections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.SIMPLEINTENTSECTION && s.Name === schemaName)
github microsoft / BotBuilder-Samples / experimental / generation / generator / packages / library / src / mergeAssets.ts View on Github external
    let newEntitySections = newLUResource.Sections.filter(s => s.SectionType === lusectiontypes.NEWENTITYSECTION)
github microsoft / BotBuilder-Samples / experimental / generation / generator / packages / library / src / mergeAssets.ts View on Github external
    let oldIntentSections = oldLUResource.Sections.filter(s => s.SectionType === lusectiontypes.SIMPLEINTENTSECTION && s.Name === schemaName)

@microsoft/bf-lu

This package is intended for Microsoft use only. It is not designed to be consumed as an independent package.

MIT
Latest version published 3 years ago

Package Health Score

64 / 100
Full package analysis

Similar packages