小编nom*_*ein的帖子

如何在Angular Universal中导入Material Module或NgxBootstrap?

目前我正在尝试使用Angular Universal构建项目.我正在使用Angular 4.如果我导入Material Module - 可以构建项目,但是当通过ts-node服务时会出现错误 -

dist\ngfactory\node_modules\@angular\material\typings\index.ngfactory.ts:9
import * as import0 from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Module._extensions..js (module.js:580:10)
Run Code Online (Sandbox Code Playgroud)

或者,如果我尝试导入NgXBootstrap,则会出现此错误 -

node_modules\ngx-bootstrap\dropdown\bs-dropdown.module.js:1
(function (exports, require, module, __filename, __dirname) { import { NgModule } from '@angular/core';
                                                          ^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
Run Code Online (Sandbox Code Playgroud)

我正在关注这个项目结构 - https://github.com/designcourse/angular-seo

我在这里粘贴代码 -

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } …
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular-universal ngx-bootstrap angular

6
推荐指数
1
解决办法
1180
查看次数

如何从Python中的CoreNLP服务器返回的字符串获取解析树?

我在corenlp服务器上使用pycorenlp。我可以以字符串格式获取解析树。但是我可以像NLTK库这样的树来获取它吗?

from pycorenlp import StanfordCoreNLP
import pprint
import nltk

nlp = StanfordCoreNLP('http://localhost:9000')

text = ('Purgrug Vobter and Juklog Qligjar vruled into the Battlefield. Vobter was about to Hellfire. Juklog Qligjar started kiblaring.')

output = nlp.annotate(text, properties={
'annotators': 'tokenize,ssplit,pos,depparse,parse',
'outputFormat': 'json'
})


print [s['parse'] for s in output['sentences']]
Run Code Online (Sandbox Code Playgroud)

输出:

[u'(ROOT\r\n  (S\r\n    (NP (NNP Purgrug) (NNP Vobter)\r\n      (CC and)\r\n      (NNP Juklog) (NNP Qligjar))\r\n    (VP (VBD vruled)\r\n      (PP (IN into)\r\n        (NP (DT the) (NN Battlefield))))\r\n    (. .)))', u'(ROOT\r\n  (S\r\n    (NP (NNP Vobter))\r\n    (VP …
Run Code Online (Sandbox Code Playgroud)

stanford-nlp corenlp-server

2
推荐指数
1
解决办法
1308
查看次数