我正在尝试使用我在此链接上找到的 LSTM 重现用于实体识别的笔记本:https : //medium.com/@rohit.sharma_7010/a-complete-tutorial-for-named-entity-recognition-and-extraction -in-natural-language-processing-71322b6fb090
当我尝试训练模型时,我收到一个我无法理解的错误(我对 tensorflow 很陌生)。特别是有错误的代码部分是这样的:
from keras.models import Model, Input
from keras.layers import LSTM, Embedding, Dense, TimeDistributed, Dropout, Bidirectional
from keras_contrib.layers import CRF
# Model definition
input = Input(shape=(MAX_LEN,))
model = Embedding(input_dim=n_words+2, output_dim=EMBEDDING, # n_words + 2 (PAD & UNK)
input_length=MAX_LEN, mask_zero=True)(input) # default: 20-dim embedding
model = Bidirectional(LSTM(units=50, return_sequences=True,
recurrent_dropout=0.1))(model) # variational biLSTM
model = TimeDistributed(Dense(50, activation="relu"))(model) # a dense layer as suggested by neuralNer
crf = CRF(n_tags+1) # CRF layer, n_tags+1(PAD)
print(model)
out …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 JSF 和 primefaces 实现一个简单的接口。我需要一个问题列表,对于每个问题,用户将能够在不同的选项之间进行选择。这些选项很长,我对单选按钮的对齐有问题。
其中一个问题的代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<div class="ui-g">
<div class="ui-g-1"></div>
<div class="ui-g-10">
<p:panelGrid columns="1" layout="grid"
styleClass="showcase-text-align-center">
<h2>Domanda 1</h2>
<p:selectOneRadio id="domanda1" layout="pageDirection">
<f:selectItem itemLabel="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " itemValue="1" />
<f:selectItem itemLabel="Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex …Run Code Online (Sandbox Code Playgroud)